>The essential function of sleep may be its restorative effect on the brain: "Sleep is of the brain, by the brain and for the brain."[95] This theory is strengthened by the fact that sleep is observed to be a necessary behavior across most of the animal kingdom, including some of the least evolved animals which have no need for other functions of sleep, such as memory consolidation or dreaming.
I'm not sure I understand the distinction you're trying to make. There's not purpose in a volitional sense in evolution, only effects. We sleep because necessary functions occur when we do and problems happen when we don't.
Or it is to conserve energy during the time that we are on the dark side of this spinning globe, since it is difficult to see in the dark.