Visceral pain caused by inflammatory bowel disease (IBD) greatly diminishes the quality of life in affected patients. Yet, the mechanism of how IBD causes visceral pain is currently not fully understood. Previous studies have suggested that the central nervous system (CNS) and gut-brain axis (GBA) play an important role in IBD-inducing visceral pain. As one of the treatments for IBD, electroacupuncture (EA) has been used to treat various types of pain and gastrointestinal diseases in clinical practice. However, whether EA relieves the visceral pain of IBD through the gut-brain axis has not been confirmed. To verify the relationship between visceral pain and CNS, the following experiments were conducted. H-NMR analysis was performed on the prefrontal cortex (PFC) tissue obtained from IBD rat models to determine the link between the metabolites and their role in EA treatment against visceral pain. Western blot assay was employed for detecting the contents of glutamate transporter excitatory amino acid transporters 2 (EAAT2) and the glutamate receptor N-methyl-D-aspartate (NMDA) to verify whether EA treatment can alleviate neurotoxic symptoms induced by abnormal increases of glutamate. Study results showed that the glutamate content was significantly increased in the PFC of TNBS-induced IBD rats. This change was reversed after EA treatment. This process was associated with increased EAAT2 expression and decreased expression of NMDA receptors in the PFC. In addition, an increase in intestinal glutamic-metabolizing bacteria was observed. In conclusion, this study suggests that EA treatment can relieve visceral pain by reducing glutamine toxicity in the PFC, and serves an alternative clinical utility.