Young animals are highly susceptible to intestinal damage due to incomplete intestinal development, making them vulnerable to external stimuli. Weaning stress in piglets, for instance, disrupts the balance of intestinal microbiota and metabolism, triggering intestinal inflammation and resulting in gut damage. Caffeic acid (CA), a plant polyphenol, can potentially improve intestinal health. Here, we evaluated the effects of dietary CA on the intestinal barrier and microbiota using a lipopolysaccharide (LPS)-induced intestinal damage model. Eighteen piglets were divided into three groups: control group (CON), LPS group (LPS), and CA + LPS group (CAL). On the 21st and 28th day, six piglets in each group were administered either LPS (80 μg/kg body weight; Escherichia coli O55:B5) or saline. The results showed that dietary CA improved the intestinal morphology and barrier function, and alleviated the inflammatory response. Moreover, dietary CA also improved the diversity and composition of the intestinal microbiota by increasing Lactobacillus and Terrisporobacter while reducing Romboutsia. Furthermore, the LPS challenge resulted in a decreased abundance of 14 different bile acids and acetate, which were restored to normal levels by dietary CA. Lastly, correlation analysis further revealed the potential relationship between intestinal microbiota, metabolites, and barrier function. These findings suggest that dietary CA could enhance intestinal barrier function and positively influence intestinal microbiota and its metabolites to mitigate intestinal damage in piglets. Consuming foods rich in CA may effectively reduce the incidence of intestinal diseases and promote intestinal health in piglets.