Universal HIV testing and treatment aims to identify all people living with HIV and offer them treatment, decreasing the number of individuals with unsuppressed HIV and thus reducing HIV transmission. Longitudinal follow-up of individuals with and without HIV in a cluster-randomized trial of communities allowed for the examination of community- and individual-level measures of HIV risk and HIV incidence. HPTN 071 (PopART) was a three-arm cluster-randomized trial conducted between 2013 and 2018 that evaluated the use of two combination HIV prevention strategies implemented at the community level to reduce HIV incidence compared to the standard of care. The trial, conducted in 21 communities in Zambia and South Africa, measured HIV incidence over 36 months in a population cohort of ∼2000 randomly selected adults per community aged 18-44. Multilevel models were used to assess the association between HIV incidence and community- and individual-level socio-demographic and behavioural risk factors, as well as prevalence of detectable virus (PDV) defined as the estimated proportion of the community with unsuppressed viral load. Overall HIV incidence was 1.49/100 person-years. Communities with less financial wealth and communities with more individuals reporting having sex partners outside of the community or two or more sexual partners had higher HIV incidence. PDV at 2 years of study was 6.8% and was strongly associated with HIV incidence: for every 50% relative reduction in community PDV, there was a 49% (95% confidence interval [CI]: 37%-58%, p < 0.001) relative decrease in HIV incidence. At the individual level; socio-economic status, AUDIT score, medical male circumcision and certain sexual behaviours were associated with HIV risk. Using data from the PopART randomized trial, we found several associations of HIV incidence with community-level measures reflecting the sexual behaviour and socio-economic make-up of each community. We also found a strong association between community PDV and HIV incidence supporting the use of PDV as a tool for monitoring progress in controlling the epidemic. Lastly, we found significant individual-level factors of HIV risk that are generally consistent with previous HIV epidemiological research. These results have the potential to identify high high-incidence communities, inform structural-level interventions, and optimize individual-level interventions for HIV prevention. ClinicalTrials.gov number, NCT01900977, HPTN 071 [PopArt].