Objective To investigate if increased length and intensity of breastfeeding mediates gestational diabetes mellitus (GDM) risk in a subsequent pregnancy. Design Multisite cohort study. Setting Western Sydney, Australia, March 2017–April 2019. Population Women with a second subsequent pregnancy after a GDM-affected first pregnancy. Methods Information on breastfeeding experience, intensity and GDM management in the first pregnancy was collected by questionnaire. The results of the oral glucose tolerance test (OGTT) in the second pregnancy were also recorded. Multivariable models for OGTT and for diagnosis of GDM were fitted and then adjusted for medical treatment of GDM in the first pregnancy, BMI, age at current pregnancy and ethnicity. Main outcome measures Second pregnancy oral glucose tolerance test (OGTT) blood glucose results and diagnosis of GDM. Results We recruited 227 women with 210 eligible for analysis. Of these women, 146 (70%) were diagnosed with recurrent GDM. We found a 19% reduction in the risk of GDM in a subsequent pregnancy if a woman breastfed for more than six months (RR 0.81, 95% CI 0.68–0.96) after adjusting for both age and BMI. In a fully adjusted model, the association was attenuated (RR 0.89, 95% CI 0.78–1.02). With the same adjusted confounders, however, both high intensity breastfeeding (2 h OGTT, P = 0.01) and breastfeeding for greater than six months (1 h OGTT, P = 0.01) were associated with a mean blood glucose decrease of 0.7mmol/L. Conclusion We found the risk of recurrent GDM was reduced by both increased duration and intensity of breastfeeding.