Dolphins and whales often sleep with one eye open in order to avoid being eaten by sharks. The ability to stay partially conscious also allows them to continue to get air while sleeping.
How dolphins handle this is to put one half of their brain to sleep, while the other half is still conscious and functioning. They then alternate which side is sleeping periodically. They stay in this state for approximately eight hours a day. Doing this allows them to be conscious enough to control their breathing and periodically swim to the surface and get air, while still giving their brain the rest it needs.