First things first, you should have awakened your wife as you was getting out of bed so she can not only protect herself, but to not follow in your footsteps later and a causing you to mistake her for a BG who you had missed.
Second thing, lights on in the house in the night.
I consider this a cardinal no-no, instead try and keep Barney in with you, or gate the hallway (you'll see why later).
Install motion detectors inside at key strategic locations, this would be a instant indicator that you have a intruder in a certain area.
"Cut the pie"
Use the corner of a wall, door entry or hallway to your advantage as cover, and keep your firearm in a ready position at all times by peeking around a little at a time to see just a little more of the room in question. It's a whole lot easier for you to shoot around a corner than them to shoot through it at you, or else they have to fully expose themselves to get a shot at you.
It's your home, you know the layout, use the darkness to your advantage.
In my home, I'll stay in the bedroom (while the wife calls 911) because I have a 30 foot long hallway and it's very hard to see down it lighted ittle alone in the dark, so I can see them, but they can't see me because unless they run in and start flipping on light switches at every room. A big no-no if you don't want me drawing a really good bead on them.
First, my wife was awake. That's why I said she stays in the bedroom. And I do keep 2 additional guns in the bedroom.
You gave me an idea to look into. Motion detectors. That's a very good idea.
^^most definitely^^In my opinion, your only major error was not giving Barney a treat. He earned at least 2-3 Pupperonis or Beggin Strips.