Cosmic gas makes up about 90% of baryonic matter in the Universe and H 2 is the closest molecule to star formation. In this work we study cold neutral gas and its H 2 component at different epochs, exploiting state-of-the-art hydrodynamic simulations that include time-dependent atomic and molecular non-equilibrium chemistry coupled to star formation, feedback effects, different UV backgrounds presented in the recent literature and a number of additional processes occurring during structure formation (ColdSIM). We predict gas evolution and contrast the mass density parameters and gas depletion timescales, as well as their relation to cosmic expansion, in light of the latest IR and (sub-)mm observations in the redshift range 2 z 7. By performing updated non-equilibrium chemistry calculations we are able to broadly reproduce the latest HI and H 2 observations. We find neutral-gas mass density parameters Ω neutral ≃ 10 −3 and increasing from lower to higher redshift, in agreement with available HI data. Because of the typically low metallicities during the epoch of reionization, time-dependent H 2 formation is mainly led by the H − channel in self-shielded gas, while H 2 grain catalysis becomes important in locally enriched sites at any redshift. UV radiation provides free electrons and facilitates H 2 build-up while heating cold metal-poor environments. Resulting H 2 fractions can be as high as ∼ 50% of the cold gas mass at z ∼ 4-8, in line with the latest measurements from high-redshift galaxies. The H 2 mass density parameter increases with time until a plateau of Ω H 2 ≃ 10 −4 is reached. Quantitatively, we find an agreement between the derived Ω H 2 values and the observations up to z ∼ 7 and both HI and H 2 trends are better reproduced by our non-equilibrium H 2based star formation modelling. The predicted gas depletion timescales decrease at lower z in the whole time interval considered, with H 2 depletion times remaining below the Hubble time and comparable to the dynamical time at all z. This implies that nonequilibrium molecular cooling is efficient at driving cold-gas collapse in a broad variety of environments and since the very early cosmic epochs. While the evolution of chemical species is clearly affected by the details of the UV background and gas self-shielding, the assumptions on the adopted initial mass function, different parameterizations of H 2 dust grain catalysis, photoelectric heating and cosmic-ray heating can affect the results in a non-trivial way. In appendix, we show detailed analyses of individual processes, as well as simple numerical parameterizations and fits to account for them. Our findings suggest that, in addition to HI, non-equilibrium H 2 observations are pivotal probes for assessing cold-gas cosmic abundances and the role of UV background radiation at different epochs.