Fix up the drug wars and the demand for illegal guns will drop. e.g. the core logic in the drug war is that policing reduces supply, thus people take less because of supply and demand. However, it doesn't work like that because instead of "take less drugs" addicts increasingly turn to crime to solve the "not enough money" problem, and that pushes up demand for illegal guns, thus increasing the market size / amount of guns in circulation.
So, cleaning up the drug wars and having sensible harm-minimization policies would help here. Reduce the size of the illegal gun market, and all other problems related to it will reduce. e.g. if the price of illegal guns is high, then it's more profitable to steal them out of people's houses, thus more guns get stolen and more need to be replaced.
A "war on illegal guns" however wouldn't have the same issues as the war on drugs. e.g. if you combat illegal guns, then the price of guns goes up. So following the "war on drugs" logic from above, criminals will need to turn to crime to be able to afford the guns they need to commit the crimes. Which is completely circular logic. Ain't going to happen. The higher gun price will in fact make your chances with armed robbery less lucrative. The difference here is the reason for the price increase: a supply reduction in illegal guns will push prices up, pricing more criminal buyers out of the gun market, while in the drug war scenario, the reason for gun prices rising was a demand increase, which is an expansionary pressure on a market.