The global incidence of nonalcoholic fatty liver disease (NAFLD) is increasing. The present study explored the effect and mechanism of berberine (BBR) on NAFLD in rats. Thirty-five Sprague-Dawley rats were randomly divided into the control and NAFLD groups, which were fed a normal diet or high-fat diet, respectively, for 8 weeks. Hematoxylin and eosin staining was performed on liver tissues and establishment of the NAFLD model was confirmed by microscopy. NAFLD rats were subsequently randomly subdivided and treated with saline or BBR for 8 weeks. The liver wet weight of rats in each group was measured, the liver tissue structure was observed by microscopy, and alanine aminotransferase (ALT), aspartate aminotransferase (AST), total cholesterol (TC), triglyceride (TG), fasting blood glucose (FBG), low-density lipoprotein (LDL) and high-density lipoprotein (HDL) levels were detected using a semi-automatic biochemical detector. Reverse transcription-quantitative PCR and western blotting were performed to determine the mRNA and protein expression levels of microsomal triglyceride transfer protein (MTTP), apolipoprotein B and low-density lipoprotein receptor (LDLR). Compared with the control group, the liver wet weight of the NAFLD rats was higher; the liver showed obvious fatty degeneration and liver TG levels increased significantly, as did serum levels of ALT, AST, TC, TG, FBG, HDL and LDL, while expression of MTTP and LDLR significantly decreased. Compared with the saline-treated NAFLD rats, the BBR-treated rats had reduced liver wet weight, improved liver steatosis and a significant decrease in liver TG levels, while ALT, AST, TC, TG, and LDL serum levels significantly decreased and MTTP levels were significantly upregulated. In conclusion, BBR treatment ameliorated the fatty liver induced by a high-fat diet in rats. Furthermore, BBR reversed the abnormal expression of MTTP and LDLR in rats with high-fat diet induced-NAFLD. The present findings suggest that fatty liver could be improved by BBR administration, via reversing the abnormal expression of MTTP and LDLR and inhibiting lipid synthesis.