Mammalian glucose homeostasis is, in part, nutritionally programmed during early neonatal life, a critical window for the formation of synapses between hypothalamic glucoregulatory centers. Although microglia are known to prune synapses throughout the brain, their specific role in refining hypothalamic glucoregulatory circuits remains unknown. Here, we show that microglia in the mediobasal hypothalamus (MBH) of mice actively engage in synaptic pruning during early life. Microglial phagocytic activity is induced following birth, regresses upon weaning from maternal milk, and is exacerbated by feeding dams a high-fat diet while lactating. In particular, we show that microglia refine perineuronal nets (PNNs) within the neonatal MBH. Indeed, transiently depleting microglia before weaning (P6-16), but not afterward (P21-31), remarkably increased PNN abundance in the MBH. Furthermore, mice lacking microglia only from P6-16 had glucose intolerance due to impaired glucose-responsive pancreatic insulin secretion in adulthood, a phenotype not seen if microglial depletion occurred after weaning. Viral retrograde tracing revealed that this impairment is linked to a reduction in the number of neurons in specific hypothalamic glucoregulatory centers that synaptically connect to the pancreatic β-cell compartment. These findings show that microglia facilitate synaptic plasticity in the MBH during early life through a process that includes PNN refinement, to establish hypothalamic circuits that regulate adult glucose homeostasis.