Background: Huang-Lian-Jie-Du-Decoction (HLJDD), a prescription of traditional Chinese medicine, has been clinically used to treat diabetes for thousands of years and its mechanism was reported to be related to gut microbiota. However, no study has explored the effect of HLJDD on the gut microbiota in type 2 diabetes mellitus (T2DM) yet. Therefore, in this study, we investigated the modulation of gut microbiota induced by HLJDD treatment in T2DM in order to unveil the underlying mechanism.Methods: A combination of high-fat diet (HFD) and streptozotocin (STZ) was used to induce T2DM in rats. Bacterial communities in the fecal samples from the control group, the T2DM model group, and the HLJDD-treated T2DM group were analyzed by 16S gene sequencing, followed with a subset sample analyzed by shotgun sequencing.Results: The HLJDD treatment significantly ameliorated hyperglycemia and inflammation in T2DM rats. Additionally, our results indicated that HLJDD treatment could not only restore the gut dysbiosis in T2DM rats, which was proved by an increasing amount of short chain fatty acids (SCFAs)-producing and anti-inflammatory bacteria such as Parabacteroides, Blautia, and Akkermansia as well as a decreasing amount of conditioned pathogenic bacteria (e.g., Aerococcus, Staphylococcus, and Corynebacterium), but also modulate the dysregulated function of gut microbiome in T2DM rats, including an up-regulation in bile acid biosynthesis as well as a reduction in glycolysis/gluconeogenesis and nucleotide metabolism.Conclusion: HLJDD treatment could ameliorate hyperglycemia and restore the dysregulated microbiota structure and function to a normal condition mainly by increasing SCFAs-producing bacteria and reducing conditioned pathogenic bacteria in T2DM rats, which provides insights into the mechanism of HLJDD treatment for T2DM from the view of gut microbiota.