NAFLD is now the most common cause of liver disease in Western countries. This Review explores the links between NAFLD, the metabolic syndrome, dysbiosis, poor diet and gut health. Animal studies in which the gut microbiota are manipulated, and observational studies in patients with NAFLD, have provided considerable evidence that dysbiosis contributes to the pathogenesis of NAFLD. Dysbiosis increases gut permeability to bacterial products and increases hepatic exposure to injurious substances that increase hepatic inflammation and fibrosis. Dysbiosis, combined with poor diet, also changes luminal metabolism of food substrates, such as increased production of certain short-chain fatty acids and alcohol, and depletion of choline. Changes to the microbiome can also cause dysmotility, gut inflammation and other immunological changes in the gut that might contribute to liver injury. Evidence also suggests that certain food components and lifestyle factors, which are known to influence the severity of NAFLD, do so at least in part by changing the gut microbiota. Improved methods of analysis of the gut microbiome, and greater understanding of interactions between dysbiosis, diet, environmental factors and their effects on the gut-liver axis should improve the treatment of this common liver disease and its associated disorders.