One of the biggest challenges of the response to the AIDS epidemic is to reach the poorest people. In 2004, Brazil implemented one of the world's largest conditional cash transfer programmes, the Bolsa Família Programme (BFP). We aimed to evaluate the effect of BFP coverage on AIDS incidence, hospitalisations, and mortality in Brazil. In this longitudinal ecological study, we developed a conceptual framework linking key mechanisms of BFP effects on AIDS indicators and used ecological panel data from 5507 Brazilian municipalities over the period of 2004-18. We used government sources to calculate municipal-level AIDS incidence, hospitalisation, and mortality rates, and used multivariable regressions analyses of panel data with fixed-effects negative binomial models to estimate the effect of BFP coverage, which was classified as low (0-29%), intermediate (30-69%), and high (≥70%), on AIDS indicators, while adjusting for all relevant demographic, socioeconomic, and health-care covariates at the municipal level. Between 2004 and 2018, in the municipalities under study, 601 977 new cases of AIDS were notified, of which 376 772 (62·6%) were in males older than 14 years, 212 465 (35·3%) were in females older than 14 years, and 12 740 (2·1%) were in children aged 14 years or younger. 533 624 HIV/AIDS-related hospitalisations, and 176 868 AIDS-related deaths had been notified. High BFP coverage was associated with reductions in incidence rate ratios of 5·1% (95% CI 0·9-9·1) for AIDS incidence, 14·3% (7·7-20·5) for HIV/AIDS hospitalisations, and 12·0% (5·2-18·4) for AIDS mortality. The effect of the BFP on AIDS indicators was more pronounced in municipalities with higher AIDS endemicity levels, with reductions in incidence rate ratios of 12·7% (95% CI 5·4-19·4) for AIDS incidence, 21·1% (10·7-30·2) for HIV/AIDS hospitalisations, and 14·7% (3·2-24·9) for AIDS-related mortality, and reductions in AIDS incidence of 14·6% (5·9-22·5) in females older than 14 years, 9·7% (1·4-17·3) in males older than 14 years, and 24·5% (0·5-42·7) in children aged 14 years or younger. The effect of BFP coverage on AIDS indicators in Brazil could be explained by the reduction of households' poverty and by BFP health-related conditionalities. The protection of the most vulnerable populations through conditional cash transfers could contribute to the reduction of AIDS burden in low-income and middle-income countries. US National Institute of Allergy and Infectious Diseases, National Institutes of Health. For the Portugese translation of the abstract see Supplementary Materials section.