Sanhuang Xiexin Decoction (SHXXD) is a classic prescription for the treatment of diabetes. Excessive hepatic glucose production (HGP) is a major determinant of the occurrence and development of diabetes. Inhibition of HGP can significantly improve type 2 diabetes mellitus (T2DM). To investigate the mechanism by which SHXXD inhibits HGP. First, a mouse model of T2DM was established through high-fat diet (HFD) feeding combined with streptozotocin (STZ) injection to determine the pharmacodynamic effect of SHXXD in T2DM mice. Then, the possible pathways induced by SHXXD in the treatment of T2DM were predicted by network pharmacology combined with transcriptomics (including target prediction, network analysis and enrichment analysis). Finally, the specific mechanism of SHXXD was elucidated by in vitro experiments. In vivo experiments showed that SHXXD reduced fasting blood glucose and alleviated weight loss in T2DM mice. Improved glucose clearance rates and insulin sensitivity improve dyslipidemia, liver tissue structural abnormalities and inflammatory cell infiltration as well as increase glycogen storage in T2DM mice. The results of network pharmacology and transcriptome analysis showed that SHXXD contained 378 compounds and 2625 targets. In total, 292 intersection targets were identified between the differentially expressed genes (DEGs) of the liver tissue insulin resistance (IR) related dataset GSE23343. KEGG enrichment analysis showed that the insulin/PI3K-Akt/FoxO signaling pathway may be related to SHXXD-mediated improvements in T2DM. In vitro experimental results showed that SHXXD increased glucose consumption by HepG2-IR cells and improved their insulin sensitivity. RT‒qPCR and Western blotting results showed that SHXXD inhibited hepatic gluconeogenesis through the insulin/PI3K-Akt/FoxO signaling pathway by promoting IGFIR, PIK3R1 and AKT2 expression and subsequently inhibiting PEPCK and FBP1 expression via phosphorylation of Foxo1. In addition, PI3K/Akt deactivated p-GSK3β through phosphorylation, thereby promoting GS expression and increasing glycogen synthesis. SHXXD can target the liver to cooperate with the insulin/PI3K-Akt/FoxO signaling pathway to inhibit HGP to alleviate T2DM.