Carbon monoxide (CO) is the best tracer of Galactic molecular hydrogen H_2_. Its lowest rotational emission lines are in the radio regime, and thanks to Galactic rotation, emission at different distances is Doppler shifted. For a given gas flow model, the observed spectra can thus be deprojected along the line of sight to infer the gas distribution. We used the CO-line survey of Dame et al. (2001ApJ...547..792D) to reconstruct the three-dimensional density of H_2_. We considered the deprojection as a Bayesian variational inference problem. The posterior distribution of the gas densities allowed us to estimate the mean and uncertainty of the reconstructed density. Unlike most of the previous attempts, we took the correlations of gas on a variety of scales into account, which allowed us to correct for some of the well-known pathologies, such as finger-of-god effects. The two gas flow models that we adopted incorporate a Galactic bar that induces radial motions in the inner few kiloparsecs and thus offers spectral resolution towards the Galactic centre. We compared our gas maps with those of earlier studies and characterise their statistical properties, for instance the radial profile of the average surface mass density. We have made our three-dimensional gas maps and their uncertainties available to the community here and at https://dx.doi.org/10.5281/zenodo.5501196.