There is also a bug that can cause you to wake up, even if monsters cannot spawn around/near the bed. If you place your bed next to a 1-block thick wall and mobs can spawn on the other side of said wall, they will wake you up. See this pic for an example:
(This is from the Minecraft Wiki)
Rollback Post to RevisionRollBack
What is this thing you call logic?
...Oh, but I threw that away last week...