Until recently, the study of major histocompability complex (MHC) mediated immunity has focused on the direct link between MHC diversity and susceptibility to parasite infection. However, MHC genes can also influence host health indirectly through the sculpting of the bacterial community that in turn shape immune responses. We investigated the links between MHC class I and II gene diversity gut microbiome diversity and micro- (adenovirus, AdV) and macro- (helminth) parasite infection probabilities in a wild population of non-human primates, mouse lemurs of Madagascar. This setup encompasses a plethora of underlying interactions between parasites, microbes and adaptive immunity in natural populations. Both MHC classes explained shifts in microbiome composition and the effect was driven by a few select microbial taxa. Among them were three taxa (Odoribacter, Campylobacter and Prevotellaceae-UCG-001) which were in turn linked to AdV and helminth infection status, correlative evidence of the indirect effect of the MHC via the microbiome. Our study provides support for the coupled role of MHC diversity and microbial flora as contributing factors of parasite infection.