Reducing the secondary inflammatory response, which is partly mediated by microglia, is a key focus in the treatment of spinal cord injury. Src homology 2-containing protein tyrosine phosphatase 2 (SHP2), encoded by PTPN11, is widely expressed in the human body and plays a role in inflammation through various mechanisms. Therefore, SHP2 is considered a potential target for the treatment of inflammation-related diseases. However, its role in secondary inflammation after spinal cord injury remains unclear. In this study, SHP2 was found to be abundantly expressed in microglia at the site of spinal cord injury. Inhibition of SHP2 expression using siRNA and SHP2 inhibitors attenuated the microglial inflammatory response in an in vitro lipopolysaccharide-induced model of inflammation. Notably, after treatment with SHP2 inhibitors, mice with spinal cord injury exhibited significantly improved hind limb locomotor function and reduced residual urine volume in the bladder. Subsequent in vitro experiments showed that, in microglia stimulated with lipopolysaccharide, inhibiting SHP2 expression promoted M2 polarization and inhibited M1 polarization. Finally, a co-culture experiment was conducted to assess the effect of microglia treated with SHP2 inhibitors on neuronal cells. The results demonstrated that inflammatory factors produced by microglia promoted neuronal apoptosis, while inhibiting SHP2 expression mitigated these effects. Collectively, our findings suggest that SHP2 enhances secondary inflammation and neuronal damage subsequent to spinal cord injury by modulating microglial phenotype. Therefore, inhibiting SHP2 alleviates the inflammatory response in mice with spinal cord injury and promotes functional recovery postinjury.