In this study, mice with type 2 diabetes mellitus (T2DM) induced by high-fat diet were used to investigate the antidiabetic effect and mechanism of action of peanut skin extract (PSE). Results revealed that the fasting blood glucose, body weight, and food intake of mice with T2DM significantly decreased after they were given PSE. The effects of 80 mg/kg PSE were similar to those of 140 mg/kg metformin (MET). The glucose tolerance and insulin sensitivity of the mice also improved. The composition of intestinal microflora in the mice significantly changed after PSE administration. In particular, no Actinobacteria was detected in the PSE-treated group, and the ratio of Firmicutes to Bacteroidetes was remarkably reduced. PSE also increased the abundance of gut microbiota involved in fatty acid biosynthesis, lipid biosynthesis, and sucrose metabolism. The abundance of gut microbiota related to aminoacyl-tRNA biosynthesis also decreased. Lipopolysaccharide, interleukin (IL)-6, IL-1β and tumor necrosis factor-α in the blood, liver and adipose tissue were reduced by PSE. Similarly, the mRNA expression levels of IkappaB kinase and nuclear factor kappaB in the hypothalamus were reduced by PSE. These results suggested that PSE and MET elicited significant antidiabetic effects by maintaining gut microbiota and inhibiting inflammation.