The mass of gas in protoplanetary discs is a quantity of great interest for assessing their planet formation potential. Disc gas masses are however traditionally inferred from measured dust masses by applying an assumed standard gas to dust ratio of g/d = 100. Furthermore, measuring gas masses based on CO observations has been hindered by the effects of CO freeze-out. Here we present a novel approach to study the midplane gas by combining C$^{18}$O line modelling, CO snowline observations and the spectral energy distribution (SED) and selectively study the inner tens of au where freeze-out is not relevant. We apply the modelling technique to the disc around the Herbig Ae star HD 163296 with particular focus on the regions within the CO snowline radius, measured to be at 90 au in this disc. Our models yield the mass of C$^{18}$O in this inner disc region of M$_{C^{18}O}$(< 90 au) ∼ 2 × 10$^{−8}$ M⊙. We find that most of our models yield a notably low g/d < 20, especially in the disc midplane (g/d < 1). Our only models with a more ISM-like g/d require C$^{18}$O to be underabundant with respect to the ISM abundances and a significant depletion of sub-micron grains, which is not supported by scattered light observations. Our technique can be applied to a range of discs and opens up a possibility of measuring gas and dust masses in discs within the CO snowline location without making assumptions about the gas to dust ratio.