A complete census of active galactic nuclei (AGNs) is a prerequisite for understanding the growth of supermassive black holes across cosmic time. A significant challenge towards this goal is the whereabouts of heavily obscured AGN that remain uncertain. This paper sets new constraints on the demographics of this population by developing a methodology that combines X-ray spectral information with priors derived from multiwavelength observations. We select X-ray AGN in the Chandra COSMOS Le gac y surv e y and fit their 2 . 2 –500 μm spectral energy distributions with galaxy and AGN templates to determine the mid-infrared (6 μm) luminosity of the AGN component. Empirical correlations between X-ray and 6 μm luminosities are then adopted to infer the intrinsic accretion luminosity at X-rays for individual AGN. This is used as prior information in our Bayesian X-ray spectral analysis to estimate physical properties, such as line-of-sight obscuration. Our approach breaks the degeneracies between accretion luminosity and obscuration that affect X-ray spectral analysis, particularly for the most heavily obscured (Compton-Thick) AGN with low photon counts X-ray spectra. The X-ray spectral results are then combined with the selection function of the Chandr a COSMOS Le gac y surv e y to deriv e the AGN space density and a Compton-Thick fraction of 21 . 0 + 16 . 1 −9 . 9 per cent at redshifts z < 0.5. At higher redshift, our analysis suggests upper limits to the Compton-Thick AGN fraction of 40 per cent . These estimates are at the low end of the range of values determined in the literature and underline the importance of multiwavelength approaches for tackling the challenge of heavily obscured AGN demographics.