Nonalcoholic fatty liver disease (NAFLD), as a common chronic liver disorder, is prevalent in the world. Recent evidence demonstrates that the "gut-liver axis" is related well to the progression of NAFLD, which regards gut microbiota and the intestinal barrier as two critical factors correlated with NAFLD. Diammonium glycyrrhizinate (DG), a compound of the natural bioactive pentacyclic triterpenoid glycoside, is the main component of licorice root extracts. The anti-inflammatory and liver protection effects of DG have already been reported, but to date, the mechanism has not been fully elucidated. In this research, we observed that DG reduced body weight, liver steatosis, as well as hepatic inflammation in NAFLD model mice induced by a high-fat diet. Illumina sequencing of the 16S rRNA revealed that DG intervention notably altered the composition of the gut microbiota in NAFLD mice. The richness of gut microbiota was significantly increased by DG. Specifically, DG reduced the Firmicutes-to- Bacteroidetes ratio and the endotoxin-producing bacteria such as Desulfovibrio and elevated the abundance of probiotics such as Proteobacteria and Lactobacillus. DG could augment the levels of short-chain fatty acid (SCFA)-producing bacteria such as Ruminococcaceae and Lachnospiraceae and promote SCFA production. In addition, DG supplementation dramatically alleviated the intestinal low-grade inflammation. Meanwhile, DG improved the expression of tight junction proteins, the goblet cell number, and mucin secretion and sequentially enhanced the function of intestinal barrier. Collectively, the prevention of NAFLD by DG might be mediated by modulating gut microbiota and restoring the intestinal barrier.