Beds are crafted 2 long blocks that can be slept in by right clicking on them, which will change the world time to morning if everyone in the world is sleeping, and it will also automatically set your spawn point to right next to the Bed. There are 4 occasions when Beds cannot be slept in: if it is daytime, if there are neutral or hostile mobs nearby, if there is somebody else already sleeping in the bed, or if the Bed is in the Nether or End, and the first 3 will result in a chat message popping up that will tell you why you cannot sleep, while trying to sleep in a Bed in the Nether or End will result in the Bed exploding.
It is possible to destroy a bed while you are on it by simply aiming slightly downward. After you do, though, touching a 2x1 wall or ceiling will cause damage, and walking into a corner will show suffocation. This will continue until you go back to sleep for the night.
The exploding bed is a reference to one of the lyrics in Notorious B.I.G's song "Suicidal Thoughts"
During the Beta version, if you place your bed near a wall, a Zombie or a Skeleton will spawn beside you, though it couldn't attack you. This glitch was removed in Beta 1.9 pre-1.
If you have a wooden house and it burns but the floor is still intact, the Bed will just simply fall down, even though it doesn't obey physics.
If your bed has blocks over it, trying to sleep will result in suffocation.
Beds have to have at least 2 blocks of air above it so you don't get stuck.
There is a bed ID in PE that is half a bed's texture.
What happens if you try to sleep in a Bed in the Nether