NOSH-NBP, a novel nitric oxide (NO) and hydrogen sulfide (H2S)-releasing hybrid, protects brain from ischemic stroke. This study mainly aimed to investigate the therapeutic effect of NOSH-NBP on ischemic stroke and the underlying mechanisms. In vivo, transient middle cerebral artery occlusion (tMCAO) was performed in C57BL/6 mice, with NO-NBP and H2S-NBP as controls. NO and H2S scavengers, carboxy-PTIO and BSS, respectively, were used to quench NO and H2S of NOSH-NBP. In vitro, BV2 microglia/BMDM were induced to the M1/2 phenotype, and conditioned medium (CM) experiments in BV2 microglia, neurons and b.End3 cerebral microvascular endothelial cells (ECs) were performed. Microglial/macrophage activation/polarization was assessed by flow cytometry, Western blot, RT-qPCR, and ELISA. Neuronal and EC survival was measured by TUNEL, flow cytometry, MTT and LDH assays. Transmission electron microscopy, EB extravasation, brain water content, TEER measurement and Western blot were used to detect blood–brain barrier (BBB) integrity and function. Interestingly, NOSH-NBP significantly reduced cerebral infarct volume and ameliorated neurological deficit, with superior effects compared with NO-NBP and/or H2S-NBP in mice after tMCAO. Both NO and H2S-releasing groups contributed to protection by NOSH-NBP. Additionally, NOSH-NBP decreased neuronal death and attenuated BBB dysfunction in tMCAO-treated mice. Furthermore, NOSH-NBP promoted microglia/macrophage switch from an inflammatory M1 phenotype to the protective M2 phenotype in vivo and in vitro. Moreover, the TLR4/MyD88/NF-κB pathway and NLRP3 inflammasome were involved in the inhibitory effects of NOSH-NBP on M1 polarization, while peroxisome proliferator activated receptor gamma signaling contributed to NOSH-NBP induced M2 polarization. These findings indicated that NOSH-NBP is a potential therapeutic agent that preferentially promotes microglial/macrophage M1–M2 switch in ischemic stroke.