To evaluate the association between cumulative body mass index (BMI) and long-term BMI change with non-alcoholic fatty liver disease (NAFLD). We included 19 477 adult participants (12 556 men and 6921 women) from the Kailuan study from January 2006 to December 2013. Cumulative BMI was assessed using a quadratic mixed-effects method by sex before the index year; then, the NAFLD outcome was followed till December 2019. The long-term BMI change was calculated as the percentage change in average cumulative BMI from the baseline BMI. During a median follow-up of 5.63 years, 6229 individuals developed incident NAFLD. Independent of baseline BMI, the NAFLD risk escalated with the cumulative BMI with adjusted hazard ratios (HRs) (95% confidence interval [CI]) of 1.60 (1.48-1.73) and 2.28 (2.06-2.53) for the intermediate tertile and the highest tertile (Ptrend <0.001). The association is amplified in women and the young. Compared to a stable weight (BMI change: -3% to 3%), NAFLD risk increased in the baseline BMI < 24 kg/m2 group with weight gain (BMI change: >3%) and decreased in BMI ≥24 kg/m2 group with weight loss (BMI change: <-3%) for men and women. However, we only observed a decreased NAFLD risk in men (HR: 0.82, 95% CI: 0.69-0.97) with BMI < 24 kg/m2 and weight loss. Monitoring cumulative BMI may help to identify high-risk NAFLD populations. The association between weight gain or loss varies by sex and baseline BMI, suggesting the importance of individualized weight management for NAFLD prevention.