Abstract Background The impact of parity on breastfeeding duration may be explained by physiological as well as psychosocial factors. The aim in the present study was to investigate the mediating influence of intention and self-efficacy on the association between the breastfeeding duration of the first and the following child. Methods A 5-year Danish cohort study with data from online questionnaires was used. Data came from 1162 women, who participated in the “Ready for child” trial in 2006–7 and gave birth to their second child within 5 years in 2011–3. Analysis included multiple regression models with exclusive/any breastfeeding duration of first child as the exposure variables, intention and self-efficacy measured as mediators, and exclusive/any breastfeeding duration of the second child as the outcome variables. Results Duration of exclusive breastfeeding of the first child was significantly associated with exclusive breastfeeding duration of the second child (p < 0.001) and with the self-reported intention and self-efficacy in the ability to breastfeed the second child (p < 0.001). The exclusive breastfeeding period was slightly longer for the second child. Self-efficacy and intention mediated the association between breastfeeding duration in the first and second child. Together the two factors explained 48% of the association in exclusive breastfeeding and 27% of the association in any breastfeeding between the first and second child. Conclusion Due to a reinforcing effect of intention and self-efficacy, breastfeeding support should focus on helping the first time mothers to succeed as well as to identify the second time mother with low self-efficacy and additional need for support