How can I avoid mobs spawning inside my house while I sleep?

According to the Minecraft Wiki, aggressive mobs won't wake you if you surround your bed with torches. Here is what it says about the mob behavior:

To ensure that you are not awakened unnecessarily during the night, the bed must not be placed along a 1 block thick wall, unless the area on the other side of the wall is also safe. If a hostile mob can get within 2 blocks of the bed, even if the blocks are separated by a wall, you will be awakened with the hostile mob standing next to you. There appears to be a slight delay before the mob attacks you, giving you time to get the first blow.


Edit: As of Minecraft 1.0, mobs will not awaken you suddenly if your bed is placed in an unideal location. Instead, the game won't let you sleep and will state that there are mobs nearby.


I had similar problems, and my bed was nowhere near a wall. The room was well lit, and I couldn't figure out the problem was. I finally found it in the wiki:

If you use your bed, and have a door with a right hinge (as viewed from the outside), monsters can still get to you and wake you up, as though no door was present. One example of this is a room with double doors, atleast one of the doors will be unsafe.

D'oh!


Jeb recently tweeted the following:

New bed behavior... Instead of being woken up by monsters, you are not allowed to sleep if monsters are nearby. Once you sleep you're safe

This means that as of Minecraft's official release next week, you will never have to worry about being woken by monsters again. \o/