Researchers have revealed in unprecedented detail how three chemicals interact in the brain to control the transition between sleep, wakefulness, attention and arousal.