The pathway of Janus-activated kinase 2 (JAK2) and signal transducer and activator of transcription 3 (STAT3) (termed as JAK2/STAT3) plays an active role in stroke-related inflammation induced by ischemic stress. Gastrodin, the primary compound in Gastrodia elata Bl, has been identified for its notable neuroprotective effects and demonstrated to ameliorate cerebral ischemia–reperfusion but its exact mechanisms governing this defense are still unclear. This study aims to investigate whether gastrodin can regulate mitochondrial function via the JAK2/STAT3 pathway to limit cerebral ischemia–reperfusion. In vivo, gastrodin significantly reduced infarct volume, improved neurobiological function, attenuated neuronal apoptosis, oxidative stress, mitochondrial impairment, mtDNA leakage, and inflammatory responses. At the cellular level, gastrodin administration rescued OGD/R-induced cell apoptosis, oxidative stress, and mitochondrial dysfunction. Mechanistically, gastrodin notably suppressed Toll-like receptor 9 (TLR9) expression, important for the recognition of disrupted endogenous DNA to produce inflammatory reactions. Furthermore, gastrodin mitigated inflammation by inhibiting JAK2/STAT3 signaling, influencing inflammatory factors to aggravate inflammation. Notably, the effects of gastrodin were abolished by Coumermycin A1 (C-A1), a JAK2 agonist, validating the role of JAK2/STAT3 signaling. In summary, gastrodin enhances the protective effect against mitochondrial damage in ischemic stroke by inhibiting JAK2/STAT3 signaling. Gastrodin is a possible therapy for cerebral ischemia.