I am inside an underground research laboratory surrounded by forest near Cologne, Germany. The walls are white, harshly illuminated by concealed lighting, there are no windows and few pictures. The room I am standing in contains a single bed, a computer and a disturbing painting of an alien landscape, with a giant flowering plant and weird futuristic space train. There are cameras fixed to the ceiling, watching my every move.

Isolated from the outside world, it could be any time of the day or night. I feel so disconnected from reality, I might no longer even be on Earth. This is exactly what the designers of this German space agency – DLR – facility intended. ‘Envihab’ is the perfect environment for scientists and physicians to test the how spaceflight affects the human body.

The latest experiment involves studying the effects of lack of sleep – a real problem for astronauts on the International Space Station (ISS). “In principle they could get enough sleep, around eight hours a night,” says Eva-Maria Elmenhorst, who is conducting the study. “But most astronauts only sleep five or six hours and that is not enough.”

Many of us limp through the day on barely enough sleep, with a steady supply of strong coffee to keep us going. As it happens, when I speak to Elmenhorst, I have been up since 04.15 to catch my flight to Germany. But I only have the relatively limited task of asking her some questions and recording the answers. Astronauts, on the other hand, are travelling at some 27,000km/h (17,000mph) around the planet and living just centimetres from the cold vacuum of space. A wrong decision, moment of carelessness or loss of concentration could mean the difference between life and death for themselves and the rest of the crew. Imagine precisely docking several tonnes of spacecraft on only five hours sleep.

But getting a good night’s sleep in space is not easy. There are no beds or pillows – astronauts sleep strapped to the wall in sleeping bags. And that’s not all. “There’re probably several reasons they don’t sleep properly,” says Elmenhorst. “Isolation, a sunrise every 90 minutes and [with the ventilation system] it’s quite noisy in the ISS.” Often, astronauts have to work shifts to monitor experiments or capture visiting supply ships.

She hopes the research will benefit shift workers on Earth and others – such as doctors and nurses – who often work long hours making life and death decisions with insufficient sleep  

To investigate how this lack of sleep affects astronauts’ performance, Elmenhorst’s team has been subjecting groups of paid volunteers to sleep deprivation experiments. “We want to show how sleep loss affects cognitive function,” she says, “and how some people cope better than others.”

As well as astronauts, she hopes the research will benefit shift workers on Earth and others – such as doctors and nurses – who often work long hours making life and death decisions with insufficient sleep. In Germany alone, Elmenhorst says some 16% of employees regularly work shifts and many workers, in often safety-critical jobs, get less than the recommended eight hours a night.

The volunteers in Elmenhorst’s experiments were given a range of daily tasks to perform, including memory exercises, reaction time tests and repetitive computer games. For five nights they were only allowed to sleep for five hours a night. This was followed by a recovery period of eight hours before a mind-frying 38-hour stint when they had to remain awake.

The doctors monitored their subjects’ brain activity using caps – like hairnets – containing multiple electrodes, took blood samples and conducted MRI scans.

Someone was always around to stop us falling asleep – Lucas, a volunteer  

“We are interested in the fundamental mechanisms in the brain that control sleepiness,” says Elmenhorst. “Even one night without sleep we see hormonal changes in the body.”

For the volunteers – motivated, they confess, primarily by the money – sitting around watching TV and chatting for the two week experiments was more difficult than they imagined. “Staying awake was hard,” says Lucas, a student who took part in the study. “Someone was always around to stop us falling asleep.”

“The only things we could do were to talk to each other, watch TV or play with the laptop,” says another volunteer, Magdalena, who is training to be a teacher. “There was always someone saying ‘Magdalena…are you awake? Magdalena, wake up!’”

To ensure the volunteers didn’t doze off, they were constantly monitored by members of the research team – who sat with them or watched them on closed-circuit monitors. If a volunteer’s eyes closed for too long, a researcher would prod them awake.

As the days went on, Lucas became aware that his memory and dexterity were deteriorating. “I noticed how bad we were doing on the tests,” he says. “I now try to get as much sleep as possible - no more all-nighters to revise.”

As well as finding an expected decline in mental performance, the research team discovered an even more disturbing biological change in the volunteers. “We have shown that five hours of sleep a night over five days slows glucose metabolism and there are hormonal changes in the body,” says Elmenhorst. This correlates with studies suggesting people who regularly work shifts suffer disproportionately from diabetes and high blood pressure.

Ensuring astronauts get enough sleep will become more important than ever  

The ultimate aim of the on-going research is to develop better daily schedules for astronauts, to prevent them from becoming too tired. As long-duration missions become more common and humanity moves towards a space-faring civilisation ensuring astronauts get enough sleep will become more important than ever.

When I speak to Elmenhorst, the latest group of volunteers has just left the Envihab facility. The irony is that she could now do with a good night’s sleep. “Most mornings I’ve had to get up at 05.00 to conduct this study,” she confesses, “and that had negative effects on my cognitive functions too.”

Join 800,000+ Future fans by liking us on Facebook, or follow us on Twitter.

If you liked this story, sign up for the weekly bbc.com features newsletter, called “If You Only Read 6 Things This Week”. A handpicked selection of stories from BBC Future, Earth, Culture, Capital, and Travel, delivered to your inbox every Friday.