From June 7, 2011, to April 2, 2015, 2848 HEU children were randomly assigned to receive co-trimoxazole (n=1423) or placebo (n=1425). The data and safety monitoring board stopped the study early because of a low likelihood of benefit with co-trimoxazole. Only 153 (5%) children were lost to follow-up (76 in the co-trimoxazole group and 77 in the placebo group), and 2053 (72%) received treatment continuously to age 15 months, death, or study closure. Mortality after the start of study treatment was similar in the two study groups: 30 children died in the co-trimoxazole group, compared with 34 in the placebo group (estimated mortality at 18 months 2·4% vs 2·6%; difference −0·2%, 95% CI −1·5 to 1·0, p=0·70). We saw no difference in hospital admissions between groups (12·5% in the co-trimoxazole group vs 17·4% in the placebo group, p=0·19) or grade 3–4 clinical adverse events (16·5% vs 18·4%, p=0·18). Grade 3–4 anaemia did not differ between groups (8·1% vs 8·3%, p=0·93), but grade 3–4 neutropenia was more frequent in the co-trimoxazole group than in the placebo group (8·1% vs 5·8%, p=0·03). More co-trimoxazole resistance in commensal Escherichia coli isolated from stool samples was seen in children aged 3 or 6 months in the co-trimoxazole group than in the placebo group (p=0·001 and p=0·01, respectively). 572 (20%) children were breastfed. HIV infection and mortality did not differ significantly by duration of breastfeeding (3·9% for 6 months vs 1·9% for 12 months, p=0·21).