Xiao Cheng Qi (XCQ) decoction, an ancient Chinese herbal mixture, has been used in treating slow-transit constipation (STC) for years. The underlying action mechanism in relieving the clinical symptoms is unclear. Several lines of evidence point to a strong link between constipation and gut microbiota. Short-chain fatty acids (SCFAs) and microbial metabolites have been shown to affect 5-HT synthesis by activating the GPR43 receptor localized on intestinal enterochromaffin cells, since 5-HT receptors are known to influence colonic peristalsis. The objective of this study was to evaluate the efficacy of XCQ in alleviating clinical symptoms in a mouse model of STC induced by loperamide. The application of loperamide leads to a decrease in intestinal transport and fecal water, which is used to establish the animal model of STC. In addition, the relationship between constipation and gut microbiota was determined. The herbal materials, composed of Rhei Radix et Rhizoma (Rhizomes of Rheum palmatum L., Polygonaceae) 55.2 g, Magnoliae Officinalis Cortex (Barks of Magnolia officinalis Rehd. et Wils, Magnoliaceae) 27.6 g, and Aurantii Fructus Immaturus (Fruitlet of Citrus aurantium L., Rutaceae) 36.0 g, were extracted with water to prepare the XCQ decoction. The constipated mice were induced with loperamide (10 mg/kg/day), and then treated with an oral dose of XCQ herbal extract (2.0, 4.0, and 8.0 g/kg/day) two times a day. Mosapride was administered as a positive drug. In loperamide-induced STC mice, the therapeutic parameters of XCQ-treated mice were determined, i.e., (i) symptoms of constipation, composition of gut microbiota, and amount of short-chain fatty acids in feces; (ii) plasma level of 5-HT; and (iii) expressions of the GPR43 and 5-HT4 receptor in colon. XCQ ameliorated the constipation symptoms of loperamide-induced STC mice. In gut microbiota, the treatment of XCQ in STC mice increased the relative abundances of Lactobacillus, Prevotellaceae_UCG_001, Prevotellaceae_NK3B31_group, Muribaculaceae, and Roseburia in feces and decreased the relative abundances of Desulfovibrio, Tuzzerella, and Lachnospiraceae_ NK4A136_group. The levels of SCFAs in stools from the STC group were significantly lower than those the control group, and were greatly elevated via treatment with XCQ. Compared with the STC group, XCQ increased the plasma level of 5-HT and the colonic expressions of the GPR43 and 5-HT4 receptor, significantly. The underlying mechanism of XCQ in anti-constipation could be related to the modulation of gut microbiota, the increase in SCFAs, the increase in plasma 5-HT, and the colonic expressions of the GPR43 and 5-HT4 receptor. Our results indicate that XCQ is a potent natural product that could be a therapeutic strategy for constipation.