OBJECTIVES: This study examined whether gestational weight gain (GWG) mediates the relationship between maternal shift work and postpartum weight retention (PPWR). METHODS: Mothers with singleton births in the Taiwan Birth Cohort Study were assessed for shift work, GWG, and PPWR. Propensity score matching balanced baseline characteristics. We applied multivariable generalized linear regression and causal mediation analysis for the associations, with GWG amount and excessive GWG as mediators. RESULTS: Shift work before pregnancy was associated with higher GWG (0.55 kg, 95% CI: 0.36-0.75) and increased odds of excessive GWG (adjusted OR: 1.18, 95% CI: 1.08-1.29). Excessive GWG mediated the relationship between shift work and PPWR, with shift workers retaining 0.37 kg more at 6 months postpartum. CONCLUSIONS: Maternal shift work before pregnancy increases GWG, contributing to PPWR. Managing GWG is crucial to reduce shift work-related PPWR.