Obesity is a risk factor for several major cancers. Associations of weight change in middle adulthood with cancer risk, however, are less clear. We examined the association of change in weight and body mass index (BMI) category during middle adulthood with 42 cancers, using multivariable Cox proportional hazards models in the European Prospective Investigation into Cancer and Nutrition cohort. Of 241 323 participants (31% men), 20% lost and 32% gained weight (>0.4 to 5.0 kg/year) during 6.9 years (average). During 8.0 years of follow‐up after the second weight assessment, 20 960 incident cancers were ascertained. Independent of baseline BMI, weight gain (per one kg/year increment) was positively associated with cancer of the corpus uteri (hazard ratio HR = 1.14; 95% confidence interval: 1.05‐1.23). Compared to stable weight (+/−0.4 kg/year), weight gain (>0.4 to 5.0 kg/year) was positively associated with cancers of the gallbladder and bile ducts (HR = 1.41; 1.01‐1.96), post‐menopausal breast (HR = 1.08, 1.00‐1.16) and thyroid (HR = 1.40; 1.04‐1.90). Compared to maintaining normal weight, maintaining overweight or obese BMI (World Health Organization categories) was positively associated with most obesity‐related cancers. Compared to maintaining the baseline BMI category, weight gain to a higher BMI category was positively associated with cancers of the post‐menopausal breast (HR = 1.19; 1.06‐1.33), ovary (HR = 1.40; 1.04‐1.91), corpus uteri (HR = 1.42; 1.06‐1.91), kidney (HR = 1.80; 1.20‐2.68) and pancreas in men (HR = 1.81; 1.11‐2.95). Losing weight to a lower BMI category, however, was inversely associated with cancers of the corpus uteri (HR = 0.40; 0.23‐0.69) and colon (HR = 0.69; 0.52‐0.92). Our findings support avoiding weight gain and encouraging weight loss in middle adulthood.