Within-day glycemic variability (GV), characterized by frequent and significant fluctuations in blood glucose levels, is a growing concern in hospitalized patients with type 2 diabetes mellitus (T2DM). It is associated with an increased risk of hypoglycemia and potentially higher long-term mortality rates. Robust clinical evidence is needed to determine whether traditional Chinese medicine (TCM) decoctions can be a beneficial addition to the management of within-day GV in this patient population. This retrospective cohort study utilized data from adult inpatients diagnosed with T2DM admitted to the Traditional Chinese Medicine Hospital of Kaifeng. The primary outcome investigated was the association between the use of TCM decoctions and improved stability of within-day GV. Blood glucose variability was assessed using the standard deviation of blood glucose values (SDBG). For each patient, the total number of hospitalization days with SDBG below 2mmol/L was calculated to represent within-day GV stability. Hospitalization duration served as the secondary outcome, compared between patients receiving TCM decoctions and those who did not. The primary analysis employed a multivariable logistic regression model, with propensity score matching to account for potential confounding variables. A total of 1,360 patients were included in the final analysis. The use of TCM decoctions was significantly associated with enhanced stability of within-day GV (OR = 1.77, 95% CI: 1.34-2.33, P < 0.01). This association was most prominent in patients with a diagnosis of deficiency syndrome (predominantly qi-yin deficiency, accounting for 74.8% of cases) and a disease duration of less than 5years (OR = 2.28, 95% CI: 1.21-4.29, P = 0.03). However, TCM decoctions did not exert a statistically significant effect on hospitalization duration among patients with T2DM (OR = 0.96, 95% CI: 0.91-1.01, P = 0.22). This study suggests that TCM decoctions may be effective in improving within-day GV stability in hospitalized patients with T2DM. This effect appears to be most pronounced in patients diagnosed with deficiency syndrome, particularly those with qi-yin deficiency and a shorter disease course. Further investigation is warranted to confirm these findings and elucidate the underlying mechanisms.