In general, astronauts are advised to sleep for eight hours at the end of their daily missions. Just like on Earth, astronauts have reported that they have dreams and nightmares and some experience snoring.
To make the environment in space livable for astronauts, pressurized cabins on spacecraft have the same kind of air as on Earth and is made to be as close to sea-level conditions as possible. However, feeling the difference in gravity is inevitable. Thus, astronauts cannot sleep on mattresses the same way they would on Earth. They have to make sure they are tethered to the floor, walls or ceilings to avoid floating away and possibly colliding with other sleeping astronauts.