Type 2 diabetes mellitus (T2DM) is a metabolic disorder characterized by hyperglycemia and insulin resistance. The incidence of T2DM is increasing globally, and a growing body of evidence suggests that gut microbiota dysbiosis may contribute to the development of this disease. Gut microbiota-derived metabolites, including bile acids, lipopolysaccharide, trimethylamine-N-oxide, tryptophan and indole derivatives, and short-chain fatty acids, have been shown to be involved in the pathogenesis of T2DM, playing a key role in the host-microbe crosstalk. This review aims to summarize the molecular links between gut microbiota-derived metabolites and the pathogenesis of T2DM. Additionally, we review the potential therapy and treatments for T2DM using probiotics, prebiotics, fecal microbiota transplantation and other methods to modulate gut microbiota and its metabolites. Clinical trials investigating the role of gut microbiota and its metabolites have been critically discussed. This review highlights that targeting the gut microbiota and its metabolites could be a potential therapeutic strategy for the prevention and treatment of T2DM.