Scientists have found new support for the age-old advice to "sleep on it."
Their work suggests that the best way to make sense of new information may be to get some quality shut-eye.
Mice allowed to sleep after being trained to perform a specific task remembered what they had learned far better than those deprived of sleep for several hours afterwards.
The researchers, from the University of Pennsylvania, also found that the five hours following learning are the crucial period when new information is lodged in the brain's memory bank.
Mice deprived of sleep five to 10 hours after learning a task showed no memory impairment.
Lead research Dr Ted Abel said: "Memory consolidation happens over a period of hours after training for a task, and certain cellular processes have to occur at precise times.
"We set out to pinpoint the specific window of time and area of the brain that are sensitive to sleep deprivation after learning."
The researchers found that sleep deprivation in the five hours immediately after learning a new task appeared to impair spatial orientation and recognition of physical surroundings - known as contextual memory.
Recollection of specific facts or events - known as cued memory - was not affected.
The findings suggest that sleep affects memory by helping to regulate activity in a part of the brain called the hippocampus.
The hippocampus is known to play a key role in contextual memory, but not in cued memory.
During the experiments the researchers used mild electric shocks to generate fear in mice.
Some mice were placed in a distinctive setting before receiving a shock, generating fear of that particular location.
Others heard a tone shortly before a shock was administered, causing them to fear the tone.
The mice were put back in same situation 24 hours later, and the researchers examined them to see which animals froze - a sign that they recognised the circumstances, and were fearful of getting a shock.
Even when deprived of sleep, mice exposed to the audible tone remained fearful the following day.
But mice that had learned to associate a general physical environment with administration of an electric shock were less likely to do so after sleep deprivation.
Dr Abel said: "It has been suggested that sleep serves a variety of physiological functions, ranging from energy conservation to refreshing the immune system.
"Another important hypothesis is that sleep regulates neuronal function during memory consolidation.
"Our findings provide support for this theory."
Professor Neil Douglas, director of the Scottish National Sleep Centre, told BBC News Online he knew of no similar studies in humans.
However, he added: "The data are very clear that sleep deprivation below six hours impairs cognitive function.
"I would certainly advise at least that much sleep to ensure your brain can function optimally in many regards, including memory."
The research is published in the journal Learning & Memory.