One of the misconceptions about shotguns, even at close range, is that they're impossible to miss with. Actually, at close range, like in a house/inside of 30 ft., the spread pattern is pretty tight. So, one cannot simply point and be guaranteed of hitting the target. But, that being said, it is a lot easier shooting a handgun. At the tactical classes that I've taken they talk about several positives of shotguns. One, as you mentioned, is the stopping power. The flip side of that, however; is what GF pointed out -- if you're using 00 buck shot, or slugs, you can often shoot through walls. The guys whom I learned from recommend using #2 shot -- it has plenty of stopping power, but not a whole lot of penetration power. But, they also recommend putting your second shell at 00 buck -- the reasoning, if you need a second shot, it's not time to fuck around. The other point about the shot gun is that unmistakable sound of a shotgun being racked. Everyone knows that sound, and it makes intruders want to vacate the premises as quickly as possible. Lastly, they said, a shot gun is much better to use as weapon itself, i.e., to hit someone with, than a handgun. Sounds stupid, but sometimes you don't want to or cannot shoot someone, you just want/need to knock the shit out of them. Well a shooty is far more effective as a bludgeon than a pistol.
GF has a point about blowing out your eardrums, but at that point, that isn't my #1 concern.