Want to ace that test tomorrow? Here’s a tip: Put down the coffee and hit the sack.

Scientists have long known that sleep, memory and learning are deeply connected. Most animals, from flies to humans, have trouble remembering when sleep deprived, and studies have shown that sleep is critical in converting short-term into long-term memory, a process known as memory consolidation.

But just how that process works has remained a mystery.

The question is, does the mechanism that promotes sleep also consolidate memory, or do two distinct processes work together? In other words, is memory consolidated during sleep because the brain is quiet, allowing memory neurons to go to work, or are memory neurons actually putting us to sleep?

In a recent paper in the journal eLife, graduate students Paula Haynes and Bethany Christmann in the Griffith Lab make a case for the latter.

Haynes and Christmann focused their research on dorsal paired medial (DPM) neurons, well-known memory consolidators in Drosophila. They observed, for the first time, that when DPM neurons are activated, the flies slept more; when deactivated, the flies kept buzzing.

These memory consolidators inhibit wakefulness as they start converting short-term to long-term memory. All this takes place in a section of the Drosophila brain called the mushroom body, similar to the hippocampus, where our memories are stored. As it turns out, the parts of the mushroom body responsible for memory and learning also help keep the Drosophila awake.

“It’s almost as if that section of the mushroom body were saying ‘hey, stay awake and learn this,’” says Christmann. “Then, after a while, the DPM neurons start signaling to suppress that section, as if to say ‘you’re going to need sleep if you want to remember this later.’”

Understanding how sleep and memory are connected in a simple system, like Drosophila, can help scientists unravel the secrets of the human brain.

“Knowing that sleep and memory overlap in the fly brain can allow researchers to narrow their search in humans,” Christmann says. “Eventually, it could help us figure out how sleep or memory is affected when things go wrong, as in the case of insomnia or memory disorders.”

To learn more about this and other fly research, check out Christmann’s blog, Fly on the Wall.

This research was funded by the National Institute of Health.