Fluctuations in global arousal are key determinants of spontaneous cortical activity and function. Several subcortical structures, including neuromodulatory nuclei like the locus coeruleus (LC), are involved in the regulation of arousal. However, much less is known about the role of cortical circuits that provide top-down inputs to arousal-related subcortical structures. Here, we investigated the role of a major subdivision of the prefrontal cortex, the anterior cingulate cortex (ACC), in arousal modulation. Pupil size, facial movements, heart rate, and locomotion were used as non-invasive measures of arousal and behavioral state. We designed a closed loop optogenetic system based on machine vision and found that real time inhibition of ACC activity during pupil dilations suppresses ongoing arousal events. In contrast, inhibiting activity in a control cortical region had no effect on arousal. Fiber photometry recordings showed that ACC activity scales with the magnitude of spontaneously occurring pupil dilations/face movements independently of locomotion. Moreover, optogenetic ACC activation increases arousal independently of locomotion. In addition to modulating global arousal, ACC responses to salient sensory stimuli scaled with the size of evoked pupil dilations. Consistent with a role in sustaining saliency-linked arousal events, pupil responses to sensory stimuli were suppressed with ACC inactivation. Finally, our results comparing arousal-related ACC and norepinephrinergic LC neuron activity support a role for the LC in initiation of arousal events which are modulated in real time by the ACC. Collectively, our experiments identify the ACC as a key cortical site for sustaining momentary increases in arousal and provide the foundation for understanding cortical-subcortical dynamics underlying the modulation of arousal states.