Objective To assess the potential bidirectional relationship between food insecurity and HIV infection in sub-Saharan Africa.Design Nationally representative HIV impact assessment household-based surveys.Setting Zambia, Eswatini, Lesotho, Uganda and Tanzania and Namibia.Participants 112 955 survey participants aged 15–59 years with HIV and recency test results.Measures Recent HIV infection (within 6 months) classified using the HIV-1 limited antigen avidity assay, in participants with an unsuppressed viral load (>1000 copies/mL) and no detectable antiretrovirals; severe food insecurity (SFI) defined as having no food in the house ≥three times in the past month.Results Overall, 10.3% of participants lived in households reporting SFI. SFI was most common in urban, woman-headed households, and in people with chronic HIV infection. Among women, SFI was associated with a twofold increase in risk of recent HIV infection (adjusted relative risk (aRR) 2.08, 95% CI 1.09 to 3.97). SFI was also associated with transactional sex (aRR 1.28, 95% CI 1.17 to 1.41), a history of forced sex (aRR 1.36, 95% CI 1.11 to 1.66) and condom-less sex with a partner of unknown or positive HIV status (aRR 1.08, 95% CI 1.02 to 1.14) in all women, and intergenerational sex (partner ≥10 years older) in women aged 15–24 years (aRR 1.23, 95% CI 1.03 to 1.46). Recent receipt of food support was protective against HIV acquisition (aRR 0.36, 95% CI 0.14 to 0.88).Conclusion SFI increased risk for HIV acquisition in women by twofold. Heightened food insecurity during climactic extremes could imperil HIV epidemic control, and food support to women with SFI during these events could reduce HIV transmission.