Why we sleep is an amazingly difficult question to answer, although there is no shortage of theories which make the attempt. A common hypothesis is that sleeping plays an important role in consolidating the memories that were made during the day. (Though as to why we need to be inactive and unconscious for this to happen, most scientists have no clue.)
Some research backing up this hypothesis has recently been completed, but it is very indirect - it measures the amount of sleep required by various ... flies! This apparently correlates well with the amount of social "experience" that the flies experience while awake.
Ganguly-Fitzgerald found that the amount of time that flies spend asleep increases with the amount of experience they acquire while awake. She captured adult flies as they emerged from their pupae and twenty-four of these were thrust, like young debutantes, into rich social environments with at least 30 other peers. Five days later, these social flies were sleeping for about twice as long as loner flies who were kept in solitary confinement. They also preferred more substantial hour-long dozes while the loners were content to catch 15 minute catnaps.
The full blog post is here.