Some people need eight hours. Others can exist on four. But the bottom line is that everybody needs sleep - it is as essential as breathing and eating. Yet, despite decades of study, scientists still do not know why we do it.

However, there are some intriguing clues and theories. One obvious clue is that we all feel better after a good night’s sleep, and much worse if deprived of a decent night’s rest. In humans the need for sleep gets so strong after a few days that nothing will keep you awake – with reports of people falling asleep standing up, even whilst being kicked or having intolerably loud music played at them. Within days of having no sleep, people report confusion, forgetfulness and hallucinations. (In case you are wondering, the world record for going without sleep is eleven days.)

But saying that we sleep because we are tired is rather like saying we eat because we are hungry – it is why we sleep, but not necessarily why we need it.

Memory aid

One theory that has emerged in recent years is that sleep helps us to process and consolidate new memories. Our memory system is a psychological wonder, and several studies have suggested that sleep provides some behind-the-scenes maintenance.

For instance, Matthew Walker and colleagues from the University of California gave volunteers aptitude tests like remembering sequences of patterns fired at them on a computer. Half the volunteers learned these patterns in the morning, and half in the evening. To test their memories he got them back into the lab – the morning learners returned after a full day of being awake, the evening learners came back after a night's sleep. Sure enough, those who were allowed to sleep had better recall of the test patterns­.

By the way, there is good news for siesta or powernap lovers. Similar comparisons indicate that you can get a memory boost from a daytime nap. So, if you have been studying or working hard in the morning, do not be too hard on yourself if you fancy closing your eyes for a while.

One school of thought is that sleep aids our memories by refreshing and reorganising them without interfering with our waking thoughts. Evidence comes from several studies using methods that record the brain directly. For instance, when rats were trained to find their way around a maze, their brains produced the same activity patterns during sleep as when they had carried out the task – suggesting that the brain was reconstructing the experience.

A rest might help ease bad experiences, too. A study published last year by Walker’s group has posed the intriguing suggestion that the brain might also deal with the memory of unpleasant or traumatic events during sleep (3).

Dream on

From this we also gain an important insight into the fascinating phenomenon of dreams. These crazy adventures our minds have while we are sleeping may be a product of our memories randomly activating so as to keep them fresh, and of the mind seeking connections between all the things we have recently experienced. This could also explain why hallucinations accompany sleep deprivation. Without the opportunity to reorganise our memories during sleep, dreams intrude into our waking lives, causing difficulty in distinguishing our inner lives from reality.

Much of this is informed speculation. It is likely that as well as fine-tuning our brains, our bodies use this opportunity to carry out a list of housekeeping tasks, for instance, repairing damaged cells.

But some scientists argue that the purpose of sleep may not be restorative. In fact, they argue that the very question "why do we sleep?" is mistaken, and that the real question should be "why are we awake?". If you are safe and warm and fed, it is a waste of energy to be awake and moving around (and possibly getting into trouble). Far better, this argument goes, is to be awake only when you have to and sleep when it suits you (4).

One thing is certain, not only do we have to sleep, but it is good for your mind and body as well. Although everyone needs a different amount of sleep, the average is about seven hours – and people who sleep a lot less than this are at a higher risk of various illnesses, such as heart disease, and a shortened lifespan.

So instead of feeling guilty the next time you fancy a nap, think about how much good it will do you.

If you would like to comment on this story or anything else you have seen on Future, head over to our Facebook page or message us on Twitter.