Human gut microbiome is a promising target for managing type 2 diabetes (T2D). Measures altering gut microbiota like oral intake of probiotics or berberine (BBR), a bacteriostatic agent, merit metabolic homoeostasis. We hence conducted a randomized, double-blind, placebo-controlled trial with newly diagnosed T2D patients from 20 centres in China. Four-hundred-nine eligible participants were enroled, randomly assigned (1:1:1:1) and completed a 12-week treatment of either BBR-alone, probiotics+BBR, probiotics-alone, or placebo, after a one-week run-in of gentamycin pretreatment. The changes in glycated haemoglobin, as the primary outcome, in the probiotics+BBR (least-squares mean [95% CI], -1.04[-1.19, -0.89]%) and BBR-alone group (-0.99[-1.16, -0.83]%) were significantly greater than that in the placebo and probiotics-alone groups (-0.59[-0.75, -0.44]%, -0.53[-0.68, -0.37]%, P < 0.001). BBR treatment induced more gastrointestinal side effects. Further metagenomics and metabolomic studies found that the hypoglycaemic effect of BBR is mediated by the inhibition of DCA biotransformation by Ruminococcus bromii. Therefore, our study reports a human microbial related mechanism underlying the antidiabetic effect of BBR on T2D. (Clinicaltrial.gov Identifier: NCT02861261).