Objective. To analyze sociodemographic and behavioral factors associated with vulnerability to HIV according to sexual orientation. Method. is is a cross-sectional study conducted using data on 3,818 people in the city of Imperatriz, Brazil, during 2015 and 2016. e survey's questionnaires addressed sociodemographic and behavioral variables. For the data analysis, association (chi-square test) and strength of association (odds ratio) were observed. A significance level of 푝 < 0.05 and adjustment for age and gender were taken into consideration. Results. A substantial portion of the sample stated they were heterosexual (88.8%). ese individuals demonstrated a lower chance of HIV infection (푝 < 0.001), sexually transmitted infections (푝 < 0.001), alcohol use (푝 < 0.001) and condom use (푝 < 0.001), compared to men who have sex with men and/or bisexuals. In this group, a er adjusting for confounding variables, the factors associated with HIV infection were being male (푝 < 0.001), unmarried (푝 < 0.001), having completed higher education (푝 < 0.001) and boasting multiple sexual partners (푝 < 0.001). Conclusion. Behavioral and sociodemographic factors of vulnerability to HIV are predominant among men who have sex with men and/or are bisexual.