High-quality diets have been found to be beneficial in preventing long-term weight gain. However, concurrent changes in diet quality and body weight over time have rarely been reported. We examined the association between 10-year changes in diet quality and body weight in the Multiethnic Cohort Study. Analyses included 53 977 African Americans, Native Hawaiians, Japanese Americans, Latinos and Whites, who completed both baseline (1993–1996, 45–69 years) and 10-year follow-up (2003–2008) surveys including a FFQ and had no history of heart disease or cancer. Using multivariable regression, weight changes were regressed on changes in four diet quality indexes, Healthy Eating Index-2015, Alternative Healthy Eating Index-2010, alternate Mediterranean Diet and Dietary Approaches to Stop Hypertension scores. Mean weight change over 10 years was 1·2 (sd 6·8) kg in men and 1·5 (sd 7·2) kg in women. Compared with stable diet quality (< 0·5 sd change), the greatest increase (≥ 1 sd increase) in the diet scores was associated with less weight gain (by 0·55–1·17 kg in men and 0·62–1·31 kg in women). Smaller weight gain with improvement in diet quality was found in most subgroups by race/ethnicity, baseline age and baseline BMI. The inverse association was stronger in younger age and higher BMI groups. Ten-year improvement in diet quality was associated with a smaller weight gain, which varied by race/ethnicity and baseline age and BMI. Our findings suggest that maintaining a high-quality diet and improving diet quality over time may prevent excessive weight gain.