It has been previously demonstrated that sparstolonin B (SsnB) inhibits toll‑like receptor (TLR)‑2 and TLR‑4. The present study investigated the effect of SsnB on neuropathic pain (NP). A chronic constriction injury (CCI) model was constructed in rats and the protein expression of TLR‑2 and TLR‑4 was determined by western blot analysis. Rats were divided into the following three groups: Rats with sham surgery (control group); rats with CCI (model group); and rats with CCI and injection of SsnB (SsnB group). The mechanical withdrawal threshold (MWT) was measured by using Von Frey filaments. In addition, the mRNA and protein expression levels of nuclear factor‑κB (NF‑κB) were investigated by reverse transcription‑quantitative polymerase chain reaction and western blot analysis, respectively, and the concentrations of tumor necrosis factor‑α (TNF‑α) and interleukin (IL)‑6 were determined by ELISA. Compared with control rats, the protein expression levels of TLR‑2 and TLR‑4 were increased in model rats (P<0.001). At 7 and 14 days after surgery, the MWTs in the model group were significantly reduced compared with the control group (P<0.001). However, the MWTs in the SsnB group were significantly increased compared with the model group (P<0.001). The results also demonstrated that the mRNA and protein expression levels of NF‑κB, and the protein expression levels of TNF‑α and IL‑6, were increased in model group compared with the control group (P<0.001). Furthermore, these increases in expression were all reduced in the SsnB group compared with the model group. Therefore, the results indicate that SsnB may alleviate NP via suppression of TLR‑2 and TLR‑4, and may be a potential drug for the treatment of NP.