Light elicits robust nonvisual effects on numerous physiological and behavioral variables, such as the human sleep-wake cycle and cognitive performance. Light effects crucially rely on properties such as dose, duration, timing, and wavelength. Recently, the use of methods such as fMRI to assess light effects on nonvisual brain responses has revealed how light can optimize brain function during specific cognitive tasks, especially in tasks of sustained attention. In this chapter, we address two main issues: how light impinges on cognition via consolidation of human sleep-wake cycles; and how light directly impacts on sleep and cognition, in particular, in tasks of sustained attention. A thorough understanding of how light affects sleep and cognitive performance may help to improve light settings at home and at the workplace in order to improve well-being.