The "easy" solution would be an aggressive gun ban. That'd take a lot of guns out of circulation. There'd still be a lot of 'illegal' guns, but it'd be a start. But that's not going to happen until we as a society agree to it, and we certainly don't at the moment. If we keep the same amount of firearms, the only way to lower the amount of these situations, is to have some comprehensive changes on the social safety net side of things, AND a general societal change where we are kinder to each other. And, again, neither of those are going to be changed anytime soon.
So... thoughts and prayers it is. It sucks. It really !@#$ing sucks. But it's the price of "freedom", I guess.
https://www.vox.com/2015/10/3/9444417/gun-violence-united-states-america
Some info on America's gun "problem" relative to other parts of the world.