© 2016 The Authors.We use spectra from the ALFALFA, GASS and COLD GASS surveys to quantify variations in the mean atomic and molecular gas mass fractions throughout the SFR-M* plane and along the main sequence (MS) of star-forming galaxies. Although galaxies well below the MS tend to be undetected in the Arecibo and IRAM observations, reliable mean atomic and molecular gas fractions can be obtained through a spectral stacking technique. We find that the position of galaxies in the SFR-M* plane can be explained mostly by their global cold gas reservoirs as observed in the H I line, with in addition systematic variations in the molecular-to-atomic ratio and star formation efficiency. When looking at galaxies within ±0.4 dex of the MS, we find that as stellar mass increases, both atomic and molecular gas mass fractions decrease, stellar bulges become more prominent, and the mean stellar ages increase. Both star formation efficiency and molecular-to-atomic ratios vary little for massive MS galaxies, indicating that the flattening of the MS is due to the global decrease of the cold gas reservoirs of galaxies rather than to bottlenecks in the process of converting cold atomic gas to stars.