An important component of pathogen evolution at the population level is evolution within hosts. Unless evolution within hosts is very slow compared to the duration of infection, the composition of pathogen genotypes within a host is likely to change during the course of an infection, thus altering the composition of genotypes available for transmission as infection progresses. We develop a nested modeling approach that allows us to follow the evolution of pathogens at the epidemiological level by explicitly considering within‐host evolutionary dynamics of multiple competing strains and the timing of transmission. We use the framework to investigate the impact of short‐sighted within‐host evolution on the evolution of virulence of human immunodeficiency virus (HIV), and find that the topology of the within‐host adaptive landscape determines how virulence evolves at the epidemiological level. If viral reproduction rates increase significantly during the course of infection, the viral population will evolve a high level of virulence even though this will reduce the transmission potential of the virus. However, if reproduction rates increase more modestly, as data suggest, our model predicts that HIV virulence will be only marginally higher than the level that maximizes the transmission potential of the virus.