This study investigated the effects of ursodeoxycholic acid (UDCA) and bile salt (BAS) supplementation on lactation performance, health, and gut microbiota in periparturient dairy cows. Fifty-one Holstein dairy cows were selected at d -28 before parturition and blocked into 3 dietary treatments, including the control (CON; n = 17) received a basal diet, whereas the UDCA (n = 17) and BAS groups (n = 17) were supplemented with 10 g/d UDCA and 20 g/d BAS from d -21 to +21, with an observation phase until d +35. Milk yield and composition were recorded weekly, whereas the DMI were measured biweekly. Blood samples were collected at d +7 and +21, whereas rumen fluid and fecal samples were collected at d +21. Milk yield was significantly higher in the UDCA group at d +21 compared with the CON group, whereas on d +28, milk yield was significantly higher in both the UDCA and BAS groups compared with the CON group, and the DMI of the UDCA group showed an increased tendency at prepartum. Plasma nonesterified fatty acids were significantly higher in the BAS group, whereas Ala aminotransferase content were significantly lower in the UDCA group compared with the control. Furthermore, the cholesterol, malondialdehyde, oxidative stress index, serum amyloid A, and haptoglobin content were significantly lower in the UDCA and BAS groups. In total, 35, 43, and 45 plasma bile acids (BA) were detected in the control, UDCA, and BAS groups, respectively. Compared with the control, 8 key BA, including UDCA, tauroursodeoxycholic acid, glycoursodeoxycholic acid, and 5 key BA, including tauro-β-muricholic acid and hyocholic acid, were identified in the UDCA and BAS groups, respectively. The concentrations of total VFA and acetate in the UDCA and BAS groups was higher than that in the CON group, and the concentration of propionate tended to be higher. The β-diversity of both rumen and gut microbiota was significantly higher in the CON, UDCA, and BAS groups, whereas no significant changes were observed in α-diversity. Key rumen VFA-production bacteria, including Prevotella_7, Succinivibrionaceae_UCG-001, and Selenomonas, were enriched in the UDCA and BAS groups, along with an increase in beneficial gut microbiota, such as Butyrivibrio, Ruminococcus, and Caproiciproducen, and a reduction in harmful bacteria, such as Stenotrophomonas and Chryseobacterium. These findings suggest that the observed improvements in production performance and health may be mediated by alterations in peripheral BA and rumen and gut microbiota, offering insights for optimizing the nutrition and health of transitional dairy cows.