Background: Breastfeeding provides a protective effect against infectious diseases in infancy. Still, immunological evidence for enhanced adaptive immunity in breastfed children remains inconclusive. Objective: To determine whether breastfeeding affects B- and T-cell memory in the first years of life. Methods: We performed immunophenotypic analysis on blood samples within a population-based prospective cohort study. Participants included children at 6 months (n=258), 14 months (n=166), 25 months (n=112) and 6 years of age (n=332) with both data on breastfeeding and blood lymphocytes. Total B- and T-cell numbers and their memory subsets were determined with 6-color flow cytometry. Mothers completed questionnaires on breastfeeding when their children were aged 2, 6, and 12 months. Multiple linear regression models with adjustments for potential confounders were performed. Results: Per month continuation of breastfeeding, a 3% (95% CI -6, -1) decrease in CD27+IgM+, a 2% (95 CI % -5, -1) decrease in CD27+IgA+ and a 2% (95% CI -4, -1) decrease in CD27-IgG+ memory B cell numbers were observed at 6 months of age. CD8 T-cell numbers at 6 months of age were 20% (95% CI 3, 37) higher in breastfed than in non-breastfed infants. This was mainly found for central memory CD8 T cells and associated with exposure to breast milk, rather than duration. The same trend was observed at 14 months, but associations disappeared at older ages. Conclusions: Longer breastfeeding is associated with increased CD8 T-cell memory, but not B-cell memory numbers in the first 6 months of life. This transient skewing towards T cell memory might contribute to the protective effect against infectious diseases in infancy.