For many years, people believed that the brain, like the body, rested during sleep. After all, we are rendered unconscious by sleep. Perhaps, it was thought, the brain just needs to stop thinking for a few hours every day. Wrong. During sleep, our brain - the organ that directs us to sleep - is itself extraordinarily active. And much of that activity helps the brain to learn, to remember and to make connections.

It wasn't so long ago that the rueful joke in research circles was that everyone knew sleep had something to do with memory - except for the people who study sleep and the people who study memory. Then, in 1994, Israeli researchers reported that the average performance for a group of people on a memory test improved when the test was repeated after a break of many hours - during which some subjects slept and others did not. In 2000, a Harvard team demonstrated that this improvement occurred only during sleep.

There are several different types of memory - including declarative (retrievable, fact-based information), episodic (events from your life) and procedural (how to do something) - and researchers have designed ways to test each of them. In almost every case, whether the test involves remembering pairs of words, tapping numbered keys in a certain order or figuring out the rules in a weather-prediction game, "sleeping on it" after first learning the task improves performance. It's as if our brains squeeze in some extra practice time while we're asleep.

This isn't to say that we can't form memories when we're awake. If someone tells you his name, you don't need to fall asleep to remember it. But sleep will make it more likely that you do. Sleep-deprivation experiments have shown that a tired brain has a difficult time capturing memories of all sorts. Interestingly, sleep deprivation is more likely to cause us to forget information associated with positive emotion than information linked to negative emotion. This could explain, at least in part, why sleep deprivation can trigger depression in some people: memories tainted with negative emotions are more likely than positive ones to "stick" in the sleep-deprived brain.

Sleep also seems to be the time when the brain's two memory systems - the hippocampus and the neocortex - "talk" with one other. Experiences that become memories are laid down first in the hippocampus, obliterating whatever is underneath. If a memory is to be retained, it must be shipped from the hippocampus to a place where it will endure - the neocortex, the wrinkled outer layer of the brain where higher thinking takes place. Unlike the hippocampus, the neocortex is a master at weaving the old with the new. And partly because it keeps incoming information at bay, sleep is the best time for the "undistracted" hippocampus to shuttle memories to the neocortex, and for the neocortex to link them to related memories.

How sleep helps us consolidate memories is still largely a mystery. A recent study from the University of Lübeck, in Germany, offers one clue. Subjects were given a list of 46 word pairs to memorize, just before sleep. Shortly after they fell asleep, as they reached the deepest stages of sleep, electrical currents were sent through electrodes on their heads to induce very slow brain waves. Such slow waves were induced at random in the brains of one group of subjects, but not another. The next morning, the slow-wave group had better recall of the words. Other types of memory were not improved, and inducing the slow waves later in the night did not have the same effect. Why and how the slow waves improved memory is not yet understood, but they are thought to alter the strengths of chemical connections, or synapses, between specific pairs of nerve cells in the brain. Memories are "stored" in these synapses: changing the strength of the synapses increases the strength of the memories they store.

It's not just memory that is improved by sleep. Recent studies indicate that sleep not only helps store facts, it also helps make connections between them. Scientific history is replete with tales of scientists with nocturnal "aha!" experiences. Dmitri Mendeleev awakened from a dream that gave him the idea for the periodic table of elements - a landmark in chemistry. Such anecdotes don't prove that sleep can produce insights, but a recent study by Ullrich Wagner and colleagues in Germany does. Wagner used a puzzle in which players were given a string of numbers, and required to make a series of seven calculations based on these numbers. The seventh calculation (which depended on the preceding six) was the "answer." Participants repeatedly played the same game with the same rules, but different sets of numbers. Some of the players played the game in the morning, then did other things for eight hours or so, then played the game again. Others played the game first in the evening, then slept, then played it again after awakening.

The players who slept did somewhat better - but that was not the important result. Cleverly, the researchers structured the game such that the second calculation always gave the same answer as the seventh calculation - the final answer. If players recognized this "hidden rule," they could get to the final answer much faster - and speed was a part of the game. The players who slept were almost three times more likely to have the insight that allowed them to spot the hidden rule - even though none of the players had been told there was a hidden rule to spot. Sleeping had allowed them to connect the dots.

Why is this important? Some sleep researchers believe that for every two hours we spend awake, the brain needs an hour of sleep to figure out what all these experiences mean, and that sleep plays a crucial role in constructing the meaning our lives come to hold. Breakdowns in such sleep-dependent processing may contribute to the development of depression, and may explain why some people who experience horrific traumas go on to develop PTSD.

A better understanding of how sleep knits our memories together could lead to new technologies that improve learning, memory and creativity, and even help treat some psychiatric disease. But perhaps the most important reason for studying sleep is simply this: we are a curious species; we spend about a third of our lives asleep; and we realize how little we understand about that third of our lives. So we continue experimenting, hoping to understand sleep better. And perhaps someday we will. After we've slept on it.