To date, the full and scientific purpose of sleep is still vague at best. Most theories depend on the idea that the body needs a period of inactivity to heal, relax, and recover from strain, and that sleep acts to force inactivity, removing the need of the brain to consciously control the body. By relaxing conscious thought to the point where the unconscious takes over and creates temporary thoughts -- dreams -- the mind is allowed to relax from its strenuous daytime activity. However, this is not true in all cases, as sick or drugged sleep does not allow as much relaxation and recovery.
Scientists have explored the question of why we sleep from many different angles.... Yet, despite decades of research and many discoveries about other aspects of sleep, the question of why we sleep has been difficult to answer.
("Why Do We Sleep, Anyway?" healthysleep.med.harvard.edu)
Most people feel automatically refreshed after a good night's sleep, without putting forth any effort. This indicates that sleeping is necessary for a certain amount of mental and physical healing. However, children and some animals sleep far beyond the normal needs for restorative sleep, which indicates that sleeping acts for some other purpose. Another issue is that of memory function; sleeping allows the brain to recover from thinking all day. Studies have shown that lack of sleep causes memory loss and impairment of brain and reflex function. Some theories state that dreams are the brain dumping its garbage activity -- the random thoughts and associations that collect during the day. In this manner, the brain can "empty" itself of random thoughts and become ready for new thoughts in the day ahead.