Birds and aquatic mammals are the only taxonomic groups known to exhibit unihemispheric slow-wave sleep (USWS). In aquatic mammals, USWS permits sleep and breathing to occur concurrently in water. However, the function of avian USWS has been unclear. Our study is based on the premise that avian USWS serves a predator detection function, since the eye contralateral to the awake hemisphere remains open during USWS. If USWS functions as a form of predator detection, then birds should be able to control both the proportion of slow-wave sleep composed of USWS and the orientation of the open eye in response to changes in predation risk. To test these predictions we recorded eye state and the EEG of mallard ducks (Anas platyrhynchos) sleeping in groups of four birds arranged in a row. Birds at the ends of the row were more exposed than those in the central positions, who were flanked on both sides by other birds, and thus should perceive a greater risk of predation. Consistent with a predator detection function, when compared to birds in the group's center, birds at the exposed ends of the row showed a 150% increase in USWS and a preference for directing the open eye away from the group, the direction from which a predator is most likely to approach. Furthermore, during USWS mallards responded rapidly to threatening visual stimuli presented to the open eye. This ability to facultatively control sleep and wakefulness simultaneously in different regions of the brain probably involves the neuroanatomical interhemispheric separation responsible for independent hemispheric functioning during wakefulness in birds.