Sleep just doesn't make sense.

"Think about it," said Gero Miesenböck, a neuroscientist at the University of Oxford. "We do it. Every animal with a brain does it. But obviously it has considerable risks."

Sleeping animals are incredibly vulnerable to attacks, with no obvious benefit to make up for it — at best, they waste precious hours that could be used finding food or seducing a mate; at worst, they could get eaten. 

"If evolution had managed to invent an animal that doesn’t need to sleep ... the selective advantage for it would be immense," Miesenböck said. "The fact that no such animal exists indicates that sleep is really vital, but we don't know why."

But Miesenböck is part of team of sleep researchers who believe they are inching closer to an answer. In a paper published in the journal Nature on Wednesday, they describe a cluster of two dozen brain cells in fruit flies that operate as a homeostatic sleep switch, turning on when the body needs rest and off again when it's time to wake up.

"It's like a thermostat," Miesenböck said of the switch, "But instead of responding to temperature, it responds to something else."

If he and his colleagues could find out what that "something" is, "we might have the answer to the mystery of sleep."

To some of us (ahem, yours truly) the idea that there's a "mystery of sleep" might seem a bit, well, strange. Don't we sleep because we get tired?

Miesenböck scoffed: "That's obviously not an answer. We don’t know what 'tired' is."

Scientists know that sleep is controlled by two systems. There's the circadian rhythm, which monitors external cues like sunlight and temperature to identify the right time to go to bed. This is how animals can ensure that their body clock is synchronized with the world around them.

Then there's the sleep homeostat, the mysterious mechanism that monitors internal cues. Something — we're not sure what — builds up in the body over the course of the day. When it hits a certain ceiling, the sleep control neurons spring into action and we start to snooze. Meanwhile, whatever chemical signal the homeostat is monitoring is cleared away. When the levels are low enough, the neurons turn off, and we awaken.

"It's beautiful, the self-correcting logic of the feedback mechanism," Miesenböck said. "It's one of those things that gets goose bumps when you see how it actually works because it's so, so unexpectedly simple and elegant."

He and his colleagues outlined the basics of this machinery in fruit fly brains in 2014. They found that electrical activity in a cluster of cells called the dorsal fan-shaped body (dFB) was correlated with sleep.

But they needed to prove that there was a direct link between the dFB neurons and sleep — that this center really was the "switch." Using a technique called optogenetics, they genetically modified brain cells to respond to light. They then used a pulse of light to trigger the release of dopamine, which interferes with the sleep control neurons.

The flies immediately woke up.

"Being able to operate the sleep switch at will has given us a chance to find out how it works," Diogo Pimentel, one of the lead authors of the study, said in a statement.

Examining the mechanism more closely, they zeroed in on one ion channel — a molecular gateway that allows electrical signals to flow between brain cells — that seemed vital to this whole process. When the flies were sleeping, the molecule stayed inactive at the centers of neurons. But when dopamine was released, it moved to the cell's exterior, causing the entire dFB complex to short circuit and waking the fruit flies up.

The scientists were also able to turn the ion channel off entirely. Those unfortunate flies descended into an endless sleep from which they couldn't wake themselves up; in the world of fruit flies, Miesenböck is pretty much the witch in Sleeping Beauty.

Since there’s a long tradition among fly geneticists of naming molecules for what happens when they're not working, he and his colleagues called the ion channel "Sandman," after the mythical bringer of sleep and bearer of dreams. 

"There's a candy-colored clown they call the Sandman," he said, reciting the lyrics of the 1963 Roy Orbison tune. "Tiptoes to my room every night. Just to sprinkle stardust —" he trailed off. 

Miesenböck says that the ability to monitor and manipulate the sleep homeostat at the molecular level opens up a bunch of new opportunities for sleep researchers. For example, scientists have long known that depriving animals of sleep can kill them.

"Now we can test the converse thing: If you take away Sandman and the flies sleep most of their lives, do they live longer? We don’t know," he said. 

He paused, reflected a moment.

"I don’t know if I would like to live longer if I am asleep most of the time," he said. "I don’t know what the difference would be from being dead. Anyway, it's getting philosophical now."

He veered back toward hard science. "If we can figure out what the homeostat responds to we would probably be a big step closer to understanding the biological function of sleep."

Read more:

The very last mammoths were dying for a drink

This asteroid almost certainly isn't going to crash into Earth and kill us all

A weird twist in DNA might explain why it's such a great blueprint for life

New Yorkers don't know their rats well enough. One 'rodentologist' wants to change that.

Dear Science: Why can't we just get rid of all the mosquitoes?