The Peculiar Reality Of Orbiting Slumber
Astronauts do not actually lie down to sleep in space. Because there is no gravity, they strap themselves into vertical sleeping bags attached to walls to prevent drifting into equipment.
Without the sensation of weight, the human body feels as if it is floating constantly, making the traditional concept of a bed irrelevant. Astronauts often tuck their arms inside their sleeping bags to keep them from flailing around while they dream. Despite these strange conditions, they still require eight hours of rest to stay alert for complex missions. It is a surreal experience to wake up hovering in the middle of a room instead of rolling out of a mattress.
Source: Sleep in space