Beneath your pillow is a fine place to keep your pistol if you think you might need it in the middle of the night. I've done it many times, living in less-than-savory neighborhoods.
A holster is a good idea, to keep you from gripping the gun in your sleep. If you're really nervous about it, leave the chamber empty. Oh, and make sure it is pointing away from you and anybody else. The four rules still apply when you are asleep.
Once, when I was in ROTC, we were ordered to sleep with our M-16s inside our sleeping bags. Sarge came through in the middle of the night and stole every rifle he could pick up, just to teach us a lesson. I had an uncomfortable night, but I still had my rifle in the morning.