Modulation of interactions among neurons can manifest as dramatic changes in the state of population dynamics in cerebral cortex. How such transitions in cortical state impact the information processing performed by cortical circuits is not clear. Here we performed experiments and computational modeling to determine how somatosensory dynamic range depends on cortical state. We used microelectrode arrays to record ongoing and whisker stimulus-evoked population spiking activity in somatosensory cortex of urethane anesthetized rats. We observed a continuum of different cortical states, at one extreme population activity exhibited small scale variability and was weakly correlated, the other extreme had large scale fluctuations and strong correlations. In experiments, shifts along the continuum often occurred naturally, without direct manipulation. In addition, in both the experiment and the model we directly tuned the cortical state by manipulating inhibitory synaptic interactions. Our principal finding was that somatosensory dynamic range was maximized in a specific cortical state, called criticality, near the tipping point midway between the ends of the continuum. The optimal cortical state was uniquely characterized by scale-free ongoing population dynamics and moderate correlations, in line with theoretical predictions about criticality. However, to reproduce our experimental findings, we found that existing theory required modifications which account for activity-dependent depression. In conclusion, our experiments indicate that in vivo sensory dynamic range is maximized near criticality and our model revealed an unanticipated role for activity-dependent depression in this basic principle of cortical function. 