Cerebral ischemia/reperfusion injury (CIRI) involves various pathogenic mechanisms, including cytotoxicity, apoptosis, inflammation, and pyroptosis. Stromal interactive molecule 2 (STIM2) is implicated in cerebral ischemia. Consequently, this study investigates the biological functions of STIM2 and its related mechanisms in CIRI progression. Middle cerebral artery occlusion/reperfusion (MCAO/R) mouse models and oxygen-glucose deprivation/reoxygenation (OGD/R) cellular models were established. STIM2 level was upregulated in experimental CIRI models, as shown by reverse transcription-quantitative polymerase chain reaction (RT-qPCR), western blotting and immunofluorescence staining. Brain infarction and edema were attenuated by STIM2 knockdown, as 2,3,5-triphenyltetrazolium chloride (TTC) staining and brain water content evaluation revealed. STIM2 knockdown relieved neuronal apoptosis, microglia activation, inflammation and pyroptosis in MCAO/R mice, as detected by terminal deoxynucleotidyl transferase dUTP nick-end labeling (TUNEL) staining, enzyme-linked immunosorbent assay (ELISA) and western blotting. Results of flow cytometry, ELISA, western blotting and cell counting kit-8 (CCK-8) assays also showed that STIM2 knockdown inhibited inflammation, apoptosis and pyroptosis in OGD/R-treated BV2 cells. Moreover, STIM2 knockdown inhibited apoptosis and pyroptosis in PC12 cells incubated with conditioned medium collected from OGD/R-exposed BV2 cells. Mechanistically, lncRNA Malat1 (metastasis associated lung adenocarcinoma transcript 1) positively regulated STIM2 expression by sponging miR-30d-5p. Their binding relationship was confirmed by luciferase reporter assays. Finally, lncRNA Malat1 elevation or miR-30d-5p knockdown abolished the sh-STIM2-induced inhibition in cell damage. In conclusion, STIM2 knockdown in microglia alleviates CIRI by inhibiting microglial activation, inflammation, apoptosis, and pyroptosis.