Importance  Breastfeeding may benefit child cognitive development, but few studies have quantified breastfeeding duration or exclusivity, nor has any study to date examined the role of maternal diet during lactation on child cognition.

Objectives  To examine relationships of breastfeeding duration and exclusivity with child cognition at ages 3 and 7 years and to evaluate the extent to which maternal fish intake during lactation modifies associations of infant feeding with later cognition.

Design, Setting, and Participants  Prospective cohort study (Project Viva), a US prebirth cohort that enrolled mothers from April 22, 1999, to July 31, 2002, and followed up children to age 7 years, including 1312 Project Viva mothers and children.

Main Exposure  Duration of any breastfeeding to age 12 months.

Main Outcomes and Measures  Child receptive language assessed with the Peabody Picture Vocabulary Test at age 3 years, Wide Range Assessment of Visual Motor Abilities at ages 3 and 7 years, and Kaufman Brief Intelligence Test and Wide Range Assessment of Memory and Learning at age 7 years.

Results  Adjusting for sociodemographics, maternal intelligence, and home environment in linear regression, longer breastfeeding duration was associated with higher Peabody Picture Vocabulary Test score at age 3 years (0.21; 95% CI, 0.03-0.38 points per month breastfed) and with higher intelligence on the Kaufman Brief Intelligence Test at age 7 years (0.35; 0.16-0.53 verbal points per month breastfed; and 0.29; 0.05-0.54 nonverbal points per month breastfed). Breastfeeding duration was not associated with Wide Range Assessment of Memory and Learning scores. Beneficial effects of breastfeeding on the Wide Range Assessment of Visual Motor Abilities at age 3 years seemed greater for women who consumed 2 or more servings of fish per week (0.24; 0.00-0.47 points per month breastfed) compared with less than 2 servings of fish per week (−0.01; −0.22 to 0.20 points per month breastfed) (P = .16 for interaction).

Conclusions and Relevance  Our results support a causal relationship of breastfeeding duration with receptive language and verbal and nonverbal intelligence later in life.