Metabolic toxins accumulate in the brain when we are awake. While sleeping, our brain cells actually shrink in size, and the toxins are easily flushed out. In addition, sleep allows the brain to organize and clean up all the things that we've been accumulating over the course of a day. It will erase the less important things and reinforce the important things that you want to remember. And if all that isn't impressive enough, your brain will also rehearse the information and procedures that you are trying to convert from a limited working memory to long-term memory.
It's as if the shutting down of the conscious part of our thinking allows all the other parts of the brain to get organized and communicate more effectively with each other, thereby creating an overall benefit to our learning and well-being.
Don't forget that the opposite is true: not enough sleep means that we are operating with a toxic brain - no joke, and no surprise because we've all felt that way before. In more severe cases, lack of sleep can lead to other physical problems, such as headaches, depression and heart disease.
Finally, regular exercise is also an indispensable way to enhance memory, increase your ability to learn and sleep better.