We examine the cosmic growth of the red sequence in a cosmological hydrodynamic simulation that includes a heuristic prescription for quenching star formation that yields a realistic passive galaxy population today. In this prescription, haloes dominated by hot gas are continually heated to prevent their coronae from fuelling new star formation. Hot coronae primarily form in haloes above ∼1012 M⊙, so that galaxies with stellar masses ∼1010.5 M⊙ are the first to be quenched and move on to the red sequence at z > 2. The red sequence is concurrently populated at low masses by satellite galaxies in large haloes that are starved of new fuel, resulting in a dip in passive galaxy number densities around ∼1010 M⊙. Stellar mass growth continues for galaxies even after joining the red sequence, primarily through minor mergers with a typical mass ratio ∼1:5. For the most massive systems, the size growth implied by the distribution of merger mass ratios is typically approximately two times the corresponding mass growth, consistent with observations. This model reproduces mass–density and colour–density trends in the local Universe, with essentially no evolution to z = 1, with the hint that such relations may be washed out by z ∼ 2. Simulated galaxies are increasingly likely to be red at high masses or high local overdensities. In our model, the presence of surrounding hot gas drives the trends with both mass and environment.