Rectal sexually transmitted infections (STI) have been associated with human immunodeficiency virus (HIV) diagnosis, but inferring a causal association requires disentangling them from receptive anal intercourse (RAI). We conducted a stratified case-control study by frequency matching 4 controls to each case within year using clinical data from men who have sex with men (MSM) attending the Seattle STD Clinic 2001 to 2014. Cases were MSM with a new HIV diagnosis and negative HIV test at 12 months or less. Controls were HIV-negative MSM. All included men had rectal STI testing, tested negative for syphilis, and had complete sexual behavior data. We categorized men by RAI: (1) none; (2) condoms for all RAI; (3) condomless RAI only with HIV-negative partners; and (4) condomless RAI with HIV-positive or unknown-status partners. We created 3 logistic regression models: (1) 3 univariate models of concurrent rectal gonorrhea, rectal chlamydia, and rectal STI in 12 months or less with new HIV diagnosis; (2) those 3 infections, plus age, race, year, number of sexual partners in 2 months or less, and methamphetamine use; and (3) model 2 with RAI categories. We calculated the population attributable risk of rectal STI on HIV diagnoses. Among 176 cases and 704 controls, rectal gonorrhea, chlamydia and rectal STI in 12 months or less were associated with HIV diagnosis. The magnitude of these associations attenuated in the second model, but persisted in model 3 (gonorrhea: adjusted odds ratio [aOR], 2.3; 95% confidence interval [CI], 1.3-3.8; chlamydia: aOR, 2.5; 95% CI, 1.5-4.3; prior STI: aOR, 3.0; 95% CI, 1.5-6.2). One in 7 HIV diagnoses can be attributed to rectal STI. Rectal STI are independently associated with HIV acquisition. These findings support the hypothesis that rectal STI play a biologically mediated causal role in HIV acquisition and support screening/treatment of STI for HIV prevention.