Context. Emission lines from protoplanetary disks originate mainly in the irradiated surface layers, where the gas is generally warmer than the dust. Therefore, interpreting emission lines requires detailed thermo-chemical models, which are essential to converting line observations into understanding disk physics. Aims. We aim at hydrostatic disk models that are valid from 0.1 AU to 1000 AU to interpret gas emission lines from UV to sub-mm. In particular, our interest lies in interpreting far IR gas emission lines, such as will be observed by the Herschel observatory, related to the Gasps open time key program. This paper introduces a new disk code called ProDiMo. Methods. We combine frequency-dependent 2D dust continuum radiative transfer, kinetic gas-phase and UV photo-chemistry, ice formation, and detailed non-LTE heating & cooling with the consistent calculation of the hydrostatic disk structure. We include Fe ii and CO ro-vibrational line heating/cooling relevant to the high-density gas close to the star, and apply a modified escapeprobability treatment. The models are characterised by a high degree of consistency between the various physical, chemical, and radiative processes, where the mutual feedbacks are solved iteratively. Results. In application to a T Tauri disk extending from 0.5 AU to 500 AU, the models show that the dense, shielded and cold midplane (z/r < ∼ 0.1, T g ≈ T d ) is surrounded by a layer of hot (T g ≈ 5000 K) and thin (n H ≈ 10 7 to 10 8 cm −3 ) atomic gas that extends radially to about 10 AU and vertically up to z/r ≈ 0.5. This layer is predominantly heated by the stellar UV (e.g. PAH-heating) and cools via Fe ii semi-forbidden and Oi 630 nm optical line emission. The dust grains in this "halo" scatter the starlight back onto the disk, which affects the photochemistry. The more distant regions are characterised by a cooler flaring structure. Beyond r > ∼ 100 AU, T g decouples from T d even in the midplane and reaches values of about T g ≈ 2T d . Conclusions. Our models show that the gas energy balance is the key to understanding the vertical disk structure. Models calculated with the assumption T g = T d show a much flatter disk structure. The conditions in the close regions (<10 AU) with densities n H ≈ 10 8 to 10 15 cm −3 resemble those of cool stellar atmospheres and, thus, the heating and cooling is more like in stellar atmospheres. The application of heating and cooling rates known from PDR and interstellar cloud research alone can be misleading here, so more work needs to be invested to identify the leading heating and cooling processes.