Understanding the genetic basis of variation in life span is a major challenge that is difficult to address in human populations. Evolutionary theory predicts that alleles affecting natural variation in life span will have properties that enable them to persist in populations at intermediate frequencies, such as late-life-specific deleterious effects, antagonistic pleiotropic effects on early and late-age fitness components, and/or sex- and environment-specific or antagonistic effects. Here, we quantified variation in life span in males and females reared in 3 thermal environments for the sequenced, inbred lines of the Drosophila melanogaster Genetic Reference Panel (DGRP) and an advanced intercross outbred population derived from a subset of DGRP lines. Quantitative genetic analyses of life span and the micro-environmental variance of life span in the DGRP revealed significant genetic variance for both traits within each sex and environment, as well as significant genotype-by-sex interaction (GSI) and genotype-by-environment interaction (GEI). Genome-wide association (GWA) mapping in both populations implicates over 2,000 candidate genes with sex- and environment-specific or antagonistic pleiotropic allelic effects. Over 1,000 of these genes are associated with variation in life span in other D. melanogaster populations. We functionally assessed the effects of 15 candidate genes using RNA interference (RNAi): all affected life span and/or micro-environmental variance of life span in at least one sex and environment and exhibited sex-and environment-specific effects. Our results implicate novel candidate genes affecting life span and suggest that variation for life span may be maintained by variable allelic effects in heterogeneous environments.