The mechanisms underlying neuroinflammation following cerebral ischemia remain unclear. Hydrogen sulfide (H2S), a newly identified gasotransmitter, has been reported to regulate inflammation. In the current study, we investigated whether the endogenous H2S production pathway contributed to microglia-mediated neuroinflammation following stroke. We used a mouse middle cerebral artery occlusion (MCAO) model and an in vitro cellular model to mimic ischemia-induced microglial neuroinflammation. Expression of the H2S synthase cystathionine β-synthase (CBS) and H2S synthetic activity were rapidly decreased in the ischemic brain tissue following MCAO. Consistently, when cultured microglia were polarized toward a pro-inflammatory phenotype with conditioned medium collected from neurons that had been subjected to oxygen-glucose deprivation (OGD neuron CM), they displayed reduced CBS expression and H2S production. Enhancing H2S bioavailability either by overexpressing CBS or by supplementing with exogenous H2S donors promoted a shift in microglial polarization from ischemia-induced pro-inflammatory phenotypes toward anti-inflammatory phenotypes. Mechanistically, microglia that were exposed to OGD neuron CM displayed reduced activation of AMP-activated protein kinase (AMPK), which was rescued by overexpressing CBS or by supplementing with H2S donors. Moreover, the promoting effects of H2S donors on microglial anti-inflammatory polarization were abolished by an AMPK inhibitor or CaMKKβ inhibitor. Our results suggested that reduced CBS-H2S-AMPK cascade activity contributed to microglia-mediated neuroinflammation following stroke. Targeting the CBS-H2S pathway is a promising therapeutic approach for ischemic stroke.