If you mean size as in "22 vs. 45", I'd say the biggest you can shoot comfortably and accurately. Since I started keeping a gun by the bed, low these many years, the gun itself has changed often, but the caliber usually started with a 4.
If you mean physical size of the gun, bigger is usually better.
A bigger gun, if you can grip it correctly (since, as the gun gets larger, the grip normally gets larger, and some folks have small hands) has many advantages. It is heavier, so has less recoil. It has a longer barrel, which makes for less noise and less muzzle flash. The extra weight of the barrel hanging out in space will usually improve the balance, making it easier to shot and to hit.
Then you got the bad side. If you are "house cleaning", the longer the barrel, the more gun comes through a door first. If the burglar is both smart and brave, he can stand off to the side of the doorway, and as that long steel tube comes through ahead of you, he can grab it and attempt to take it away from you. The longer the barrel, the easier this is to do - leverage. That, by the way, is why I don't recommend shotguns - 18 inches of barrel sticking out in front gives lots of leverage. But even with a pistol, it would be easier for someone to take a 7 1/2" Super Blackhawk out of your hand, than it would a 1 7/8" Chiefs Special.
For those reasons, my bedside gun is usually a 4" large frame double action revolver, in 41, 44 or 45.