Aims. To constrain for the first time the mean mass and extent of the molecular gas of a mass-complete sample of normal > 10 10 M star-forming galaxies at 0.4 < z < 3.6. Methods. We apply an innovative uv-based stacking analysis to a large set of archival Atacama Large Millimeter/submillimeter Array (ALMA) observations using a mass-complete sample of main-sequence (MS) galaxies. This stacking analysis, performed on the Rayleigh-Jeans dust continuum emission, provides accurate measurements of the mean mass and extent of the molecular gas of galaxy populations, which are otherwise individually undetected. Results. The molecular gas mass of MS galaxies evolves with redshift and stellar mass. At all stellar masses, the molecular gas fraction decreases by a factor of ∼ 24 from z ∼ 3.2 to z ∼ 0. At a given redshift, the molecular gas fraction of MS galaxies decreases with stellar mass, at roughly the same rate as their specific star formation rate (SFR/M ) decreases. The molecular gas depletion time of MS galaxies remains roughly constant at z > 0.5 with a value of 300-500 Myr, but increases by a factor ∼ 3 from z ∼ 0.5 to z ∼ 0. This evolution of the molecular gas depletion time of MS galaxies can be predicted from the evolution of their molecular gas surface density and a seemingly universal MS-only Σ M mol − Σ SFR relation with an inferred slope of ∼ 1.13, i.e., the so-called Kennicutt-Schmidt (KS) relation. The far-infrared size of MS galaxies shows no significant evolution with redshift or stellar mass, with a mean circularized half-light radius of ∼2.2 kpc. Finally, our mean molecular gas masses are generally lower than previous estimates, likely caused by the fact that literature studies were largely biased towards individually-detected MS galaxies with massive gas reservoirs. Conclusions. To first order, the molecular gas content of MS galaxies regulates their star formation across cosmic time, while variation of their star formation efficiency plays a secondary role. Despite a large evolution of their gas content and SFRs, MS galaxies evolved along a seemingly universal MS-only KS relation.