Using the star formation rates from the SDSS galaxy sample, extracted using the MOPED algorithm, and the empirical Kennicutt law relating star formation rate to gas density, we calculate the time evolution of the gas fraction as a function of the present stellar mass. We show how the gas-to-stars ratio varies with stellar mass, finding good agreement with previous results for smaller samples at the present epoch. For the first time we show clear evidence for progressive gas loss with cosmic epoch, especially in low-mass systems. We find that galaxies with small stellar masses have lost almost all of their cold baryons over time, whereas the most massive galaxies have lost little. Our results also show that the most massive galaxies have evolved faster and turned most of their gas into stars at an early time, thus strongly supporting a downsizing scenario for galaxy evolution.