Résumé : Background High quantities of tumour-infiltrating lymphocytes (TILs) in primary HER2-positive breast cancer are associated with improved prognosis and response to therapy. We aimed to investigate the prognostic role of host antitumour immunity as represented by baseline quantities of TILs in patients with advanced HER2-positive breast cancer treated with either pertuzumab or placebo in addition to trastuzumab and docetaxel. Methods CLEOPATRA was a randomised phase 3 study comparing the addition of either pertuzumab or placebo to first-line therapy with trastuzumab and docetaxel for patients with locally recurrent, unresectable, or metastatic HER2-positive breast cancer. We assessed the quantity of stromal TILs in prospectively collected tumour samples and investigated their association with progression-free survival, overall survival, clinicopathological characteristics, and pertuzumab treatment. We estimated hazard ratios (HR) and 95% CIs with multivariate Cox regression models fitting stromal TILs as a continuous variable (per 10% increment). The CLEOPATRA trial is registered with ClinicalTrials.gov, number NCT00567190. Findings Tumour samples from 678 (84%) of 808 participants were evaluable for TILs, including 519 (77%) archival samples, 155 (23%) freshly obtained samples (collected 45 days or fewer before randomisation), and four samples of unknown archival status. Median follow-up was 50 months (IQR 41–54) for progression-free survival and 51 months (IQR 46–57) for overall survival. 519 progression-free survival events occurred and 358 patients died. The median TIL value was 10% (IQR 5–30). Freshly obtained tumour samples had significantly lower TIL values than did archival samples (10·00% [95% CI 5·00–20·00] vs 15·00% [5·00–35·00]; p=0·00036). We detected no significant association between TIL values and progression-free survival (adjusted HR 0·95, 95% CI 0·90–1·00, p=0·063). However, for overall survival, each 10% increase in stromal TILs was significantly associated with longer overall survival (adjusted HR 0·89, 95% CI 0·83–0·96, p=0·0014). The treatment effect of pertuzumab did not differ significantly by stromal TIL value for either progression-free survival (pinteraction=0·23) or overall survival (pinteraction=0·21). Interpretation In patients with advanced HER2-positive breast cancer treated with docetaxel, trastuzumab, and pertuzumab or placebo, higher TIL values are significantly associated with improved overall survival, suggesting that the effect of antitumour immunity extends to the advanced setting. Future clinical studies in this cancer subtype should consider TILs as a stratification factor and investigate whether therapies that can augment immunity could potentially further improve survival. Funding F Hoffmann-La Roche–Genentech and the Breast Cancer Research Foundation.