Context : Spatially resolved observations of circumstellar disks at millimeter wavelengths allow detailed comparison with theoretical models for the radial and vertical distribution of the material . Aims : We investigate the physical structure of the gas component of the disk around the pre-main-sequence star HD169142 and test the disk model derived from the spectral energy distribution . Methods : The ^ { 13 } CO and C ^ { 18 } O J =2–1 line emission is observed from the disk with 1 \aas@@fstack { \prime \prime } 4 resolution using the Submillimeter Array . We adopt the disk physical structure derived from a model which fits the spectral energy distribution of HD169142 . We obtain the full three-dimensional information on the CO emission with the aid of a molecular excitation and radiative transfer code . This information is used for the analysis of our observations and previous ^ { 12 } CO J =2–1 and 1.3 mm continuum data . Results : The spatially resolved ^ { 13 } CO and C ^ { 18 } O emission shows a Keplerian velocity pattern The disk is seen at an inclination close to 13 ^ { \circ } from face-on . We conclude that the regions traced by different CO isotopologues are distinct in terms of their vertical location within the disk , their temperature and their column densities . With the given disk structure , we find that freeze-out is not efficient enough to remove a significant amount of CO from gas phase . Both observed lines match the model prediction both in flux and in the spatial structure of the emission . Therefore we use our data to derive the ^ { 13 } CO and C ^ { 18 } O mass and consequently the ^ { 12 } CO mass using standard isotopic ratios . Conclusions : We constrain the total disk gas mass to ( 0.6-3.0 ) \times 10 ^ { -2 } M _ { \odot } . Adopting a maximum dust opacity of 2 cm ^ { 2 } g ^ { -1 } _ { dust } we derive a minimum dust mass of 2.16 \times 10 ^ { -4 } M _ { \odot } from the fit to the 1.3 mm data . Comparison of the derived gas and dust mass shows that the gas to dust mass ratio of 100 is only possible under the assumption of a dust opacity of 2 cm ^ { 2 } /g ^ { -1 } and ^ { 12 } CO abundance of 10 ^ { -4 } with respect to H _ { 2 } . However , our data are also compatible with a gas to dust ratio of 25 , with a dust opacity of 1 cm ^ { 2 } /g ^ { -1 } and ^ { 12 } CO abundance of 2 \times 10 ^ { -4 } .