The mechanism by which a good night's sleep improves learning and memory has been discovered by scientists.
The team in China and the US used advanced microscopy to witness new connections between brain cells - synapses - forming during sleep.
Their study, published in the journal Science, showed even intense training could not make up for lost sleep.
Experts said it was an elegant and significant study, which uncovered the mechanisms of memory.
It is well known that sleep plays an important role in memory and learning. But what actually happens inside the brain has been a source of considerable debate.
Researchers at New York University School of Medicine and Peking University Shenzhen Graduate School trained mice in a new skill - walking on top of a rotating rod.
They then looked inside the living brain with a microscope to see what happened when the animals were either sleeping or sleep deprived.
Their study showed that sleeping mice formed significantly more new connections between neurons - they were learning more.
And by disrupting specific phases of sleep, the research group showed deep or slow-wave sleep was necessary for memory formation.
During this stage, the brain was "replaying" the activity from earlier in the day.
Prof Wen-Biao Gan, from New York University, told the BBC: "Finding out sleep promotes new connections between neurons is new, nobody knew this before.
"We thought sleep helped, but it could have been other causes, and we show it really helps to make connections and that in sleep the brain is not quiet, it is replaying what happened during the day and it seems quite important for making the connections."
This is just the latest piece of science to highlight the importance of sleep.
A new reason for sleep was discovered last year when experiments showed the brain used sleep to wash away waste toxins built up during a hard day's thinking.
However, there are concerns that people are not getting enough sleep.
As part of the BBC's Day of the Body Clock, Prof Russell Foster argued that society had become "supremely arrogant" in ignoring the importance of sleep, leading to "serious health problems".
- heart disease
- type-2 diabetes
The reward for more sleep, Prof Foster argues, is we would all be "better human beings."
Further tests showed how significant sleep was.
Mice doing up to an hour's training followed by sleep were compared with mice training intensively for three hours but then sleep deprived.
The difference was still stark, with the sleepers performing better and the brain forming more new connections.
Prof Gan added: "One of the implications is for kids studying, if you want to remember something for long periods you need these connections.
"So it is probably better to study and have good sleep rather than keep studying."
Commenting on the findings, Dr Raphaelle Winsky-Sommerer, from the University of Surrey, told the BBC: "This is very impressive, carefully crafted and using a combination of exquisite techniques to identify the underlying mechanisms of memory.
"They provide the cellular mechanism of how sleep contributes to dealing with experiences during the day.
"Basically it tells you sleep promotes new synaptic connections, so preserve your sleep."