The precise effects of HIV-1 on the gut microbiome are unclear. Initial cross-sectional studies provided contradictory associations between microbial richness and HIV serostatus and suggested shifts from Bacteroides to Prevotella predominance following HIV-1 infection, which have not been found in animal models or in studies matched for HIV-1 transmission groups. In two independent cohorts of HIV-1-infected subjects and HIV-1-negative controls in Barcelona (n = 156) and Stockholm (n = 84), men who have sex with men (MSM) predominantly belonged to the Prevotella-rich enterotype whereas most non-MSM subjects were enriched in Bacteroides, independently of HIV-1 status, and with only a limited contribution of diet effects. Moreover, MSM had a significantly richer and more diverse fecal microbiota than non-MSM individuals. After stratifying for sexual orientation, there was no solid evidence of an HIV-specific dysbiosis. However, HIV-1 infection remained consistently associated with reduced bacterial richness, the lowest bacterial richness being observed in subjects with a virological-immune discordant response to antiretroviral therapy. Our findings indicate that HIV gut microbiome studies must control for HIV risk factors and suggest interventions on gut bacterial richness as possible novel avenues to improve HIV-1-associated immune dysfunction.