Stroke is associated with high morbidity and mortality, and much remains unknown about the injury-related mechanisms that occur following reperfusion. This study aimed to explore the roles of Toll-like receptor 2 (TLR2) and sphingosine kinase 1 (Sphk1) in microglial cells in inflammatory responses induced by cerebral ischemia/reperfusion (I/R). For this purpose, C57BL/6 mice were randomly divided into 4 groups as follows: the sham-operated group, the I/R group, the I/R group treated with TLR2 antibody, and the I/R group treated with N,N-dimethylsphingosine. Focal cerebral I/R was induced by middle cerebral artery occlusion. Double-labeling immunofluorescence was used to observe the protein expression of TLR2 and Sphk1 in the ischemic brain tissue. Quantitative polymerase chain reaction was performed to determine the mRNA levels of TLR2 and Sphkl in ischemic brain tissue. Enzyme-linked immunosorbent assay was carried out to detect the protein contents of interleukin (IL)-1β, tumor necrosis factor-α (TNF‑α), IL-17 and IL-23 in ischemic brain tissue. The results revealed that I/R upregulated TLR2 and Sphk1 expression in microglial cells, and the inhibition of either TLR2 or Sphk1 inhibited the expression of the pro-inflammatory cytokines, IL-1β, TNF-α, IL-17 and IL-23. Notably, the inhibition of TLR2 activity also decreased Sphk1 expression. These results thus indicate that the activation of microglial cells, via a TLR2→Sphk1→pro-inflammatory cytokine (IL-1β, TNF-α, IL-17 and IL-23) pathway, may participate in I/R injury.