Early weaning is an effective method for improving the utilization rate of sows in intensive pig farms. However, weaning stress induces diarrhea and intestinal damage in piglets. Berberine (BBR) is known for its anti-diarrhea properties and ellagic acid (EA) is known for its antioxidant properties, however, whether their combination improves diarrhea and intestinal damage in piglets has not been studied, and the mechanism remains unclear. To explore the combined effects in this experiment, a total of 63 weaned piglets (Landrace × Yorkshire) were divided into three groups at 21 days. Piglets in the Ctrl group were treated with a basal diet and 2 mL saline orally, while those in the BE group were treated with a basal diet supplemented with 10 mg/kg (BW) BBR, 10 mg/kg (BW) EA, and 2 mL saline orally. Piglets in the FBE group were treated with a basal diet and 2 mL fecal microbiota suspension from the BE group orally, respectively, for 14 days. Compared with the Ctrl group, dietary supplementation with BE improved growth performance by increasing the average daily gain and average daily food intake and reducing the fecal score in weaned piglets. Dietary supplementation with BE also improved intestinal morphology and cell apoptosis by increasing the ratio of villus height to crypt depth and decreasing the average optical density of apoptotic cells; meanwhile, improvements also involved attenuating oxidative stress and intestinal barrier dysfunction by increasing the total antioxidant capacity, glutathione, and catalase, and upregulating the mRNA expressions of Occludin, Claudin-1, and ZO-1. Interestingly, the oral administration of a fecal microbiota suspension to piglets fed BE had similar effects to those of the BE group. According to 16S rDNA sequencing analysis, dietary supplementation with BE altered the composition of the microbiota, includingfirmicutes,bacteroidetes,lactobacillus,phascolarctobacterium, andparabacteroides, and increased the metabolites of propionate and butyrate. In addition, Spearman analysis revealed that improvements in growth performance and intestinal damage were significantly correlated with differential bacteria and short-chain fatty acids (SCFAs). In brief, dietary supplementation with BE improved the growth performance and intestinal damage by altering the gut microbiota composition and SCFAs in weaned piglets.