I don't really like to get into the "best" weapon. Mission determines gear, training dictates what tactics will be effective and just as everyone has different budget/home/neighbor/kids equation, they have different levels of training. Realistically, there are so many scenarios and topics involved in this area that it could be its own subforum.
A few thoughts on different home situations that you should be thinking off though:
If you live in an urban area with a good PD and no kids, invest in a whatever gun you are comfortable with and reinforced bedroom door. Don't clear the house if you don't need too. Make a fatal funnel and park yourself at the end until PD responds.
If you have kids, but have a two story house, and everyone is upstairs at night, have a plan to control the stairwell until PD responds. A stairwell is a great choke and short of grenades or flash bangs there is no sure fire way to clear them.
Know and understand the ROE that your local PD uses. There have been several situations where homeowners are clearing their house only to be fired upon by PD in the street or in the yard that see someone in their home with gun and decided to shoot the homeowner that was no immediate threat to them.
Training to clear your house is important, especially if you live in the country or have a bad PD, but if you can avoid it, I would suggest that.
Also, stashing a gun in the bedroom is all well and good but a significant portion of home invasions happen while the family is gathered for the evening but not yet in bed. Do you answer the door with a gun? Do you have a weapons staged by the door in case of a knock knock style home invasion?
Lots of things to discuss inside this broad topic...