The prefrontal cortex (PFC) is a cortical brain region that regulates various cognitive functions. One distinctive feature of the PFC is its protracted adolescent maturation, which is necessary for acquiring mature cognitive abilities in adulthood. Here, we show that microglia, the brain's resident immune cells, contribute to this maturational process. We find that transient and cell-specific deficiency of prefrontal microglia in adolescence is sufficient to induce an adult emergence of PFC-associated impairments in cognitive functions, dendritic complexity, and synaptic structures. While prefrontal microglia deficiency in adolescence also altered the excitatory-inhibitory balance in adult prefrontal circuits, there were no cognitive sequelae when prefrontal microglia were depleted in adulthood. Thus, our findings identify adolescence as a sensitive period for prefrontal microglia to act on cognitive development.