Despite established nutritional benefits of human milk, evidence regarding breastfeeding’s protective effect against childhood adiposity remains equivocal across subpopulations. This study investigates sex- and race-specific heterogeneity in the longitudinal association between duration of breastfeeding and early childhood BMI percentile trajectories. Data were drawn from the Early Childhood Longitudinal Study, Birth Cohort, a nationally representative US prospective cohort (N 8500). The primary outcome was child BMI percentile from anthropometric measurements taken at 9, 24, 36, 48 and 60 months. Breastfeeding duration was categorised as never, less than 6 months and 6 months or longer. Stepwise hierarchical linear modelling, specifying non–linear individual growth curves, was utilised. Models were stratified by sex and adjusted for maternal, obstetric and sociodemographic confounders. A distinct sex-specific effect of breastfeeding was identified, whereby a duration of 6 months or longer significantly lowered BMI percentile trajectories in girls (b = −3·70, 95 % CI: −5·86, −1·54) but yielded no significant association in boys. BMI percentiles by race/ethnicity also varied between sexes. Among boys, only Hispanic infants exhibited significantly higher percentiles than Non-Hispanic (NH) Whites (b = 4·61, 95 % CI: 2·63, 6·60), whereas among girls, both Hispanic (b = 3·26, 95 % CI: 1·24, 5·29) and NH Black infants (b = −3·14, 95 % CI: −5·38, −0·90) showed significant differences relative to NH Whites. No significant interaction emerged between breastfeeding duration and race/ethnicity. These findings suggest that paediatric obesity prevention strategies may benefit from considering sex-specific mechanisms and addressing the structural factors associated with racial disparities.