Both have their place. It depends on your home/layout and the tactics employed as well as the user. Neither is really better.
Shotguns are cheap, have lots of brutal power, lots of recoil, can be short stroked (if it's a pump), low round capacity (compared to a 30 round AR), are generally longer, have lots of brutal power, and have lots of brutal power..... did I mention they have lots of brutal power?
ARs are more expensive, easier to control (less recoil), offer lots of rounds, generally a smaller wound channel, they are shorter and easier to manuver (if we are talking a short rifle), and offer quicker follow up shots.
Weapon lights are good if you learn how to use them..... You should probably identify your target before touching the trigger.
In general, if your selected round won't penetrate drywall, I wouldn't expect it to penetrate enough bad guy. The only exception may be the AR in 5.56 as it has the unique property of tumbling when it hits the first board allowing for nastyness on the target, and rapid loss of energy when on drywall. That doesn't mean it's safe to use on drywall, but may provide better margin. Your tactics/strategy should consider the other occupants of the home and neighbors. All that being said..... in a shotgun give me 00 buck.