Laura Lewis and her team of researchers have been putting in late nights in their Boston University lab. Lewis ran tests until around 3:00 in the morning, then ended up sleeping in the next day. It was like she had jet lag, she says, without changing time zones. It’s not that Lewis doesn’t appreciate the merits of a good night’s sleep. She does. But when you’re trying to map what’s happening in a slumbering human’s brain, you end up making some sacrifices. “It’s this great irony of sleep research,” she says. “You’re constrained by when people sleep.”

Her results, published today in the journal Science, show how our bodies clear toxins out of our brains while we sleep and could open new avenues for treating and preventing neurodegenerative diseases like Alzheimer’s.

When we sleep our brains travel through several phases, from a light slumber to a deep sleep that feels like we’ve fallen unconscious, to rapid eye movement (REM) sleep, when we’re more likely to have dreams. Lewis’ work looks at non-REM sleep, that deep phase which generally happens earlier in the night and which has already been associated with memory retention. One important 2013 study on mice showed that while the rodents slept, toxins like beta amyloid, which can contribute to Alzheimer’s disease, got swept away.

Lewis was curious how those toxins were cleared out and why that process only happened during sleep. She suspected that cerebrospinal fluid, a clear, water-like liquid that flows around the brain, might be involved. But she wasn’t sure what was unique about sleep. So her lab designed a study that measured several different variables at the same time.

Study participants had to lie down and fall asleep inside an MRI machine. To get realistic sleep cycles, the researchers had to run the tests at midnight, and they even asked subjects to stay up late the night before so people would be primed to drift off once the test began.

Lewis outfitted the participants with an EEG cap so she could look at the electrical currents flowing through their brains. Those currents showed her which stage of sleep the person was in. Meanwhile, the MRI measured the blood oxygen levels in their brains and showed how much cerebrospinal fluid was flowing in and out of the brain. “We had a sense each of these metrics was important, but how they change during sleep and how they relate to each other during sleep was uncharted territory for us,” she says.

What she discovered was that during non-REM sleep, large, slow waves of cerebrospinal fluid were washing over the brain. The EEG readings helped show why. During non-REM sleep, neurons start to synchronize, turning on and off at the same time. “First you would see this electrical wave where all the neurons would go quiet,” says Lewis. Because the neurons had all momentarily stopped firing, they didn’t need as much oxygen. That meant less blood would flow to the brain. But Lewis’s team also observed that cerebrospinal fluid would then rush in, filling in the space left behind.

“It’s a fantastic paper,” says Maiken Nedergaard, a neuroscientist at the University of Rochester who led the 2013 study that first described how sleep can clear out toxins in mice. “I don’t think anybody in their wildest fantasy has really shown that the brain’s electrical activity is moving fluid. So that’s really exciting.”

One big contribution of the paper is it helps show that the systems Nedergaard has been studying in mice are present and hugely important for humans too. “It’s telling you sleep is not just to relax,” says Nedergaard. “Sleep is actually a very distinct function.” Neurons don't all turn off at the same time when we're awake. So brain blood levels don't drop enough to allow substantial waves of cerebrospinal fluid to circulate around the brain and clear out all the metabolic byproducts that accumulate, like beta amyloid.