Post-infectious irritable bowel syndrome (PI-IBS) is a functional bowel disease that develops following an acute gastrointestinal infection. Electroacupuncture (EA) can regulate the gut microbiota and alleviate visceral hypersensitivity. Glial cell-derived neurotrophic factor (GDNF) is a potential factor in visceral hypersensitivity reactions. The aim of this study was to explore whether EA could alleviate visceral hypersensitivity in PI-IBS by regulating gut microbiota through GDNF signaling. 2,4,6-trinitrobenzene sulfonic acid (TNBS) was used to induce visceral hypersensitivity in PI-IBS mice. Assessment of intestinal visceral sensitivity using the abdominal withdrawal reflex (CRD). 16S ribosomal RNA (16S rRNA) sequencing to profile the gut microbiome community. GDNF can exacerbate the imbalances of the gut microbiota and increase visceral hypersensitivity compared with the model group. Whereas EA treatment increases the richness and diversity of the gut microbiota, decreases differences among species and alleviates visceral sensitivity. EA can alleviate visceral hypersensitivity in PI-IBS by regulating the gut microbiota via GDNF signaling, providing new insights for mechanistic research on EA in PI-IBS treatment.