1. Testosterone mediates several key aspects of male reproduction, but maintaining high testosterone levels can reduce long-term survival. One of the proposed pathways by which testosterone can influence survival is through increased risk of parasite infection. The hormone has the potential to affect the transmission of sexually transmitted infections by promoting behaviours that increase sexual contact rates and/or by decreasing immune function. 2. We hypothesized that males with high concentrations of testosterone would increase their chances of being infected with sexually transmitted bacteria, which would manifest as increased diversity of cloacal bacteria. To test this hypothesis, we measured circulating testosterone concentrations in breeding male rufous-collared sparrows (Zonotrichia capensis) and collected cloacal swabs to quantify bacterial diversity using 16S rRNA gene amplicon sequencing. 3. There was a positive correlation between testosterone concentrations and the phylogenetic diversity of cloacal bacteria. In addition, individuals with high and medium testosterone concentrations had cloacal bacterial communities that were more similar to each other than to those of low testosterone individuals. Finally, when considering bacterial taxa that are potential avian pathogens, we found that the relative abundance of Chlamydiae, a class of obligate intracellular parasites, was positively correlated with testosterone concentrations. 4. Two non-exclusive explanations for these results are that testosterone affects behaviours that lead to increased sexual contacts and thus the exposure and acquisition of additional phylogenetically diverse bacteria, and/or that testosterone is altering the immune system or the cloacal environment, thus making it easier for bacteria to colonize. Either way, these data suggest that increased exposure to sexually transmitted pathogens in the form of cloacal bacteria could be a cost of maintaining high testosterone levels.