Humans with drug addiction exhibit compulsive drug-seeking associated with impairment of prefrontal cortex cognitive function. Whether prefrontal cortex dysfunction is a consequence of chronic drug exposure, or mediates the transition from drug use to drug dependence, is unknown. The current study investigates whether a history of escalated vs controlled cocaine intake is associated with specific working memory impairments, and long-lasting alterations of the dorsomedial prefrontal cortex and orbitofrontal cortex in rats. Working memory was assessed in rats with a history of extended (6 h per session) or limited (1 h per session) access to cocaine (0.5 mg/kg per injection), 3-17 days after the last self-administration session, using a delayed nonmatching-to-sample task. The density of neurons, oligodendrocytes, and astrocytes was quantified in the dorsomedial prefrontal cortex and orbitofrontal prefrontal cortex 2 months after the last self-administration session. Working memory impairments were observed after a history of chronic and escalated cocaine intake, but not after repeated limited access to cocaine. Moreover, working memory impairments were correlated with a decreased density of neurons and oligodendrocytes but not astrocytes in the dorsomedial prefrontal cortex, and with a decreased density of oligodendrocytes in the orbitofrontal cortex. Considering the role of the prefrontal cortex in goal-directed behavior, the prefrontal cortex dysfunctions observed here may exacerbate the loss of control associated with increased drug use and facilitate the progression to drug addiction.