|Individuals vary in their immune genotype, inbreeding coefficient f, immune responses, survival to adulthood, and adult longevity. However, whether immune genes predict survival or longevity, whether such relationships are mediated through immune responses, and how f affects immune genotype remain unclear. We use a wild song sparrow (Melospiza melodia) population in which survival to adulthood, adult longevity, and f were measured precisely, and in which immune responses have previously been assessed. We investigate four toll-like receptor (TLR) and the major histocompatibility complex (MHC) class IIB exon 2 genes. We test whether immune genes predict fitness (survival to adulthood or adult longevity); whether immune genes predict immune response; whether immune response predicts fitness and whether fitness, immune responses, or immune genotypes are correlated with f. We find that survival to adulthood is not associated with immune gene variation, but adult longevity is decreased by high MHC allele diversity (especially in birds that were relatively outbred), and by the presence of a specific MHC supertype. Immune responses were affected by specific immune genotypes. Survival to adulthood and adult longevity were not predicted by immune response, implying caution in the use of immune response as a predictor for fitness. We also found no relationship between f and immune genotype. This finding indicates that immune gene associations with longevity and immune response are not artefacts of f, and suggests that pathogen-mediated selection at functional loci can slow the loss of genetic variation arising from genetic drift and small population size.