Sleep almost certainly came to be part of our lives as the result of a simple trade-off: it is impossible to build an eye that is optimized for both day and night. You could have two sets of eyes, but it would be impossible to build a visual cortex optimized for both without vastly increasing the brain’s size and energy requirements.