Liuwei Dihuang Formula (LD), a classic prescription for kidney-yin deficiency in China, has shown promising therapeutic potential in type 2 diabetes mellitus (T2DM). Given the critical roles of gut microbiota and bile acid metabolism in T2DM, the mechanisms of LD in regulating these pathways require further clarification. In this study, we investigated the effects of LD on gut microbiota and bile acid metabolism in T2DM rats. LD administration significantly lowered fasting blood glucose levels and improved lipid profiles, thereby ameliorating glycolipid metabolism. 16S rRNA sequencing revealed that LD restored gut microbiota homeostasis by reversing T2DM-associated alterations, including increased Lactobacillus and decreased Bifidobacterium, Allobaculum, Turicibacter, and Blautia. Plasma concentrations of ten bile acids were simultaneously quantified using liquid chromatography-tandem mass spectrometry, demonstrating that LD significantly altered bile acid metabolism. Moreover, LD treatment up-regulated Takeda G protein-coupled receptor 5 (TGR5) and down-regulated farnesoid X receptor (FXR) mRNA expression in the ileum, accompanied by enhanced secretion of glucagon-like peptide-1 (GLP-1) and peptide tyrosine-tyrosine (PYY). Collectively, these findings suggest that LD ameliorates glycolipid metabolism in T2DM rats by regulating the gut microbiota-bile acid axis, thereby providing new mechanistic insights into its antidiabetic effects.