Weaning stress can induce diarrhea, intestinal damage and flora disorder of piglets, leading to slow growth and even death of piglets. Traditional Chinese medicine residue contains a variety of active ingredients and nutrients, and its resource utilization has always been a headache. Therefore, we aimed to investigate the effects of traditional Chinese medicine residues (Xiasangju, composed of prunellae spica, mulberry leaves, and chrysanthemum indici flos) on growth performance, diarrhea, immune function, and intestinal health in weaned piglets. Forty-eight healthy Duroc× Landrace × Yorkshire castrated males weaned aged 21 days with similar body conditions were randomly divided into 6 groups with eight replicates of one piglet. The control group was fed a basal diet, the antibiotic control group was supplemented with 75 mg/kg chlortetracycline, and the residue treatment groups were supplemented with 0.5%, 1.0%, 2.0% and 4.0% Xiasangju residues. The results showed that dietary Xiasangju residues significantly reduced the average daily feed intake, but reduced the diarrhea score (P < 0.05). The 1.0% and 2.0% Xiasangju residues significantly increased the serum IgM content of piglets, and the 0.5%, 1.0%, 2.0% and 4.0% Xiasangju residues significantly increased the serum IgG content, while the 1.0%, 2.0% and 4.0% Xiasangju residues significantly increased the sIgA content of ileal contents (P < 0.05). Dietary Xiasangju residues significantly increased the villus height and the number of villus goblet cells in the jejunum and ileum, and significantly decreased the crypt depth (P<0.05). The relative mRNA expression of IL-10 in the ileum was significantly increased in the 1% and 2% Xiasangju residues supplemented groups (P < 0.05), while IL-1β in the ileum was downregulated (P < 0.05). Xiasangju residues improved the gut tight barrier, as evidenced by the enhanced expression of Occludin and ZO-1 in the jejunum and ileum. The diets with 1% Xiasangju residues significantly increased the relative abundance of Lactobacillus johnsonii, and 2% and 4% Xiasangju residues significantly increased the relative abundance of Weissella jogaeotgali (P < 0.05). Dietary supplementation with 0.5%, 1.0%, 2% and 4% with Xiasangju residues significantly decreased the relative abundance of Escherichia coli and Treponema porcinum (P < 0.05). In summary, dietary supplementation with Xiasangju residues improves intestinal health and gut microbiota in weaned piglets.