Wolbachia infect a variety of arthropod and nematode hosts, but in arthropods, host phylogenetic relationships are usually poor predictors of strain similarity. This suggests that new infections are often established by horizontal transmission. To gain insight into the factors affecting the probability of horizontal transmission among host species, we ask how host phylogeny, geographical distribution and ecology affect patterns of Wolbachia strain similarity. We used multilocus sequence typing (MLST) to characterize Wolbachia strain similarity among dipteran hosts associated with fleshy mushrooms. Wolbachia Supergroup A was more common than Supergroup B in Diptera, and also more common in mycophagous than non-mycophagous Diptera. Within Supergroup A, host family within Diptera had no effect on strain similarity, and there was no tendency for Wolbachia strains from sympatric host species to be more similar to one another than to strains from hosts in different biogeographical realms. Supergroup A strains differed between mycophagous and non-mycophagous Diptera more than expected by chance, suggesting that ecological associations can facilitate horizontal transmission of Wolbachia within mycophagous fly communities. For Supergroup B, there were no significant associations between strain similarity and host phylogeny, biogeography, or ecology. We identified only two cases in which closely related hosts carried closely related Wolbachia strains, evidence that Wolbachia-host co-speciation or early introgression can occur but may not be a major contributor to overall strain diversity. Our results suggest that horizontal transmission of Wolbachia can be influenced by host ecology, thus leading to partial restriction of Wolbachia strains or strain groups to particular guilds of insects.