Abstract Background Many species are threatened with extinction as their population sizes decrease with changing environments or face novel pathogenic threats. A reduction of genetic diversity at major histocompatibility complex (MHC) genes may have dramatic effects on populations’ survival, as these genes play a key role in adaptive immunity. This might be the case for chimpanzees, the MHC genes of which reveal signatures of an ancient selective sweep likely due to a viral epidemic that reduced their population size a few million years ago. To better assess how this past event affected MHC variation in chimpanzees compared to humans, we analysed several indexes of genetic diversity and linkage disequilibrium across seven MHC genes on four cohorts of chimpanzees and we compared them to those estimated at orthologous HLA genes in a large set of human populations. Results Interestingly, the analyses uncovered similar patterns of both molecular diversity and linkage disequilibrium across the seven MHC genes in chimpanzees and humans. Indeed, in both species the greatest allelic richness and heterozygosity were found at loci A, B, C and DRB1, the greatest nucleotide diversity at loci DRB1, DQA1 and DQB1, and both significant global linkage disequilibrium and the greatest proportions of haplotypes in linkage disequilibrium were observed at pairs DQA1 ~ DQB1, DQA1 ~ DRB1, DQB1 ~ DRB1 and B ~ C. Our results also showed that, despite some differences among loci, the levels of genetic diversity and linkage disequilibrium observed in contemporary chimpanzees were globally similar to those estimated in small isolated human populations, in contrast to significant differences compared to large populations. Conclusions We conclude, first, that highly conserved mechanisms shaped the diversity of orthologous MHC genes in chimpanzees and humans. Furthermore, our findings support the hypothesis that an ancient demographic decline affecting the chimpanzee populations – like that ascribed to a viral epidemic – exerted a substantial effect on the molecular diversity of their MHC genes, albeit not more pronounced than that experienced by HLA genes in human populations that underwent rapid genetic drift during humans’ peopling history. We thus propose a model where chimpanzees’ MHC genes regenerated molecular variation through recombination/gene conversion and/or balancing selection after the selective sweep.