The prefrontal cortex (PFC) regulates a wide range of sensory experiences. Chronic pain is known to impair normal neural response, leading to enhanced aversion. However, it remains unknown how nociceptive responses in the cortex are processed at the population level and whether such processes are disrupted by chronic pain. Using in vivo endoscopic calcium imaging, we identify increased population activity in response to noxious stimuli and stable patterns of functional connectivity among neurons in the prelimbic (PL) PFC from freely behaving rats. Inflammatory pain disrupts functional connectivity of PFC neurons and reduces the overall nociceptive response. Interestingly, ketamine, a well-known neuromodulator, restores the functional connectivity among PL-PFC neurons in the inflammatory pain model to produce anti-aversive effects. These results suggest a dynamic resource allocation mechanism in the prefrontal representations of pain and indicate that population activity in the PFC critically regulates pain and serves as an important therapeutic target.