Background: The human leukocyte antigen (HLA) locus includes several genes with key roles in antigen presentation and immune response, some of them inclusively found to be associated with non-obstructive azoospermia. Still, HLA connections to other infertility phenotypes such as semen hyperviscosity (SHV), asthenozoospermia (AST), and oligozoospermia (OLI) have been often neglected. Objectives: In this work, we aimed to evaluate the association of HLA class I and II genes with SHV, AST, and OLI phenotypes while exploring a possible role in an adaptive immune response to sexually transmitted diseases (STD). Materials and methods: Whole-exome sequencing was performed in a Portuguese cohort of 71 infertility cases and 68 controls, followed by HLA typing using a specific software-HLA*PRG:LA tool. Molecular screenings of seven STD were carried out in a subset of 72 samples (30 cases and 42 controls). Results: Statistical tests uncovered three protective alleles: HLA-A*11:01, associated with all forms of male infertility (p = 0.0006); HLA-DQB1*03:02 with SHV and OLI (P SHV = 0.0303, P OLI = 0.0153); and HLA-A*29:02 with OLI (p = 0.0355), which was found to interfere in sperm number together with HPV (p = 0.0313). Five risk alleles were also identified: two linked with SHV (HLA-B*50:01, p = 0.0278; and HLA-C*06:02, p = 0.0461), another one with both SHV and OLI (HLA-DQA1*05:01, P SHV = 0.0444 and P OLI =0.0265), and two with OLI (HLA-C*03:03, p = 0.0480; and HLA-DQB1*03:01, p = 0.0499). Here, HLA-C*03:03 carriers tend to be HPV infected. Conclusions: The application of HLA*PRG:LA tool to the study of male infertility provided novel insights for an HLA correlation with semen quality, namely among SHV and OLI phenotypes. The discovery of an HLA-A*29:02/HPV crosstalk, together with former reports of HLA alleles conferring resistance-susceptibility to diverse human pathogens, raises the hypothesis of a mechanistic link between male infertility, HLA polymorphism, and host response to STD.