A good night's sleep really does clear the mind as the brain flushes toxic material out of its cells, new research has shown.
The findings suggest a new biological purpose for sleep and indicate that waste disposal may underlie its restorative properties.
There could also be far reaching implications for understanding and treating diseases such as Alzheimer's.
"This study shows that the brain has different functional states when asleep and when awake," said US researcher Dr Maiken Nedergaard, from the University of Rochester. "In fact, the restorative nature of sleep appears to be the result of the active clearance of the by-products of neural activity that accumulate during wakefulness."
The findings, published in the journal Science, show that the brain's unique method of cleansing itself - known as the glymphatic system - is highly active during sleep.
As we slumber, it clears away toxins that would otherwise build up and trigger neurological disorders such as Alzheimer's diease.
The scientists also found that during sleep the brain's cells reduce in size to allow waste to be removed more effectively.
The purpose of sleep has vexed both philosophers and scientists since ancient Greek times.
From an evolutionary perspective, sleep is a puzzle. Virtually every animal species, from fruit flies to whales and humans needs some form of sleep. Yet being asleep has significant drawbacks, such as leaving an animal at the mercy of predators, and using up valuable time that could be better spent foraging or looking for mates.
Recent research has shown that sleep can help the brain store and consolidate memories, but these benefits are not thought to outweigh its disadvantages. This has led scientists to suspect that sleep must have a more essential biological function.
The new findings hinge on the discovery last year of a previously unknown waste disposal system unique to the brain.
In other parts of the body, the lymphatic system gets rid of cellular waste. But this mechanism does not extend to the brain, which is a closed "fortress" protected by a complex system of molecular gateways called the Blood Brain Barrier.
Mouse studies revealed how the brain's glymphatic waste disposal system works, by pumping cerebral spinal fluid (CSF) through brain tissue and flushing toxins into the blood circulation and liver.
Scientists speculated that the cleaning process may not be compatible with functions the brain must perform while awake and actively processing information.
This was confirmed by experiments in mice which showed that the glymphatic system was almost 10 times more active during sleep. The studies also showed that the sleeping brain cleared away significantly more amyloid-beta - a toxic protein linked to Alzheimer's - than the wakeful brain.
"The brain only has limited energy at its disposal and it appears that it must choose between two different functional states - awake and aware or asleep and cleaning up," said Dr Nedergaard. "You can think of it like having a house party. You can either entertain the guests or clean up the house, but you can't really do both at the same time."
Another startling discovery was that cells in the brain shrink by 60% during sleep. The contraction creates more space between the cells and allows CSF to wash more freely through brain tissue. When we are awake, the brain's cells are closer together, restricting the flow of CSF.
The hormone noradrenaline was also found to be less active during sleep. Normally the hormone is released in bursts when the brain needs to become more alert, typically in response to fear. Noradrenaline may serve as a "master regulator" controlling the contraction and expansion of brain cells during sleep-wake cycles, the scientists believe.
"These findings have significant implications for treating 'dirty brain' disease like Alzheimer's," said Dr Nedergaard. "Understanding precisely how and when the brain activates the glymphatic system and clears waste is a critical first step in efforts to potentially modulate this system and make it work more efficiently."
Dr Simon Ridley, from the charity Alzheimer's Research UK, said: "We all know that a bad night's sleep can affect our memory and thinking skills in the short term, and this early stage research suggests that sleep may be crucial for clearing potentially harmful material from the brain.
"It would be important to determine whether continued problems with sleep may have long-term effects on the brain's ability to clear away excess proteins.
"Much more research would be needed to confirm whether a breakdown of the brain's waste clearance is to blame for diseases like Alzheimer's."