The basal forebrain provides the primary source of cholinergic input to the cortex, and it has a crucial function in promoting wakefulness and arousal. However, whether rapid changes in basal forebrain neuron spiking in awake animals can dynamically influence sensory perception is unclear. Here we show that basal forebrain cholinergic neurons rapidly regulate cortical activity and visual perception in awake, behaving mice. Optogenetic activation of the cholinergic neurons or their V1 axon terminals improved performance of a visual discrimination task on a trial-by-trial basis. In V1, basal forebrain activation enhanced visual responses and desynchronized neuronal spiking; these changes could partly account for the behavioral improvement. Conversely, optogenetic basal forebrain inactivation decreased behavioral performance, synchronized cortical activity and impaired visual responses, indicating the importance of cholinergic activity in normal visual processing. These results underscore the causal role of basal forebrain cholinergic neurons in fast, bidirectional modulation of cortical processing and sensory perception.