Methamphetamine (MA) use is a major public health problem in the United States, especially among people living with HIV (PLWH). Many MA-induced neurotoxic effects are mediated by inflammation and gut microbiota may play a role in this process, yet the effects of MA on the microbiome have not been adequately explored. Therefore, we performed 16S rRNA gene sequencing on rectal swab samples from 381 men who have sex with men, 48% of whom were PLWH and 41% of whom used MA. We compared microbiome composition between MA users and non-users while testing for potential interactions with HIV and controlling for numerous confounders using inverse probability of treatment weighting. We found that MA use explained significant variation in overall composition (R2 = 0.005, p = 0.008) and was associated with elevated Finegoldia, Parvimonas, Peptoniphilus, and Porphyromonas and reduced Butyricicoccus and Faecalibacterium, among others. Genera including Actinomyces and Streptobacillus interacted with HIV status, such that they were increased in HIV+ MA users. Finegoldia and Peptoniphilus increased with increasing frequency of MA use, among others. In summary, MA use was associated with a microbial imbalance favoring pro-inflammatory bacteria, including some with neuroactive potential and others that have previously been associated with poor HIV outcomes.