This study presents a new view on the association between education and longevity. In contrast to the earlier literature, which focused on inefficient health behavior of the less educated, we investigate the extent to which the education gradient can be explained by fully rational and efficient behavior of all social strata. Specifically, we consider a life-cycle model in which the loss of body functionality, which eventually leads to death, can be accelerated by unhealthy behavior and delayed through health expenditure. Individuals are heterogeneous with respect to their return to education. The proposed theory rationalizes why individuals equipped with a higher return to education chose more education as well as a healthier lifestyle. When calibrated for the average male US citizen, the model motivates about 50% percent of the observable education gradient by idiosyncratic returns to education, with causality running from education to longevity. The theory also explains why compulsory schooling has comparatively small effects on longevity and why the gradient gets larger over time through improvements in medical technology.