Context. In dense parts of interstellar clouds (≥10 5 cm −3 ), dust and gas are expected to be in thermal equilibrium, being coupled via collisions. However, previous studies have shown that in the presence of intense radiation fields, the temperatures of the dust and gas may remain decoupled even at higher densities. Aims. The objective of this work is to study in detail the temperatures of dust and gas in the photon-dominated region S 140, especially around the deeply embedded infrared sources IRS 1−3 and at the ionization front. Methods. We derive the dust temperature and column density by combining Herschel-PACS continuum observations with SOFIA observations at 37 μm and SCUBA data at 450 μm. We model these observations using simple greybody fits and the DUSTY radiative transfer code. For the gas analysis we use RADEX to model the CO 1−0, CO 2−1, 13 CO 1−0 and C 18 O 1−0 emission lines mapped with the IRAM-30 m telescope over a 4 field. Around IRS 1−3, we use HIFI observations of single-points and cuts in CO 9−8, 13 CO 10−9 and C 18 O 9−8 to constrain the amount of warm gas, using the best fitting dust model derived with DUSTY as input to the non-local radiative transfer model RATRAN. The velocity information in the lines allows us to separate the quiescent component from outflows when deriving the gas temperature and column density. Results. We find that the gas temperature around the infrared sources varies between ∼35 and ∼55 K. In contrast to expectation, the gas is systematically warmer than the dust by ∼5−15 K despite the high gas density. In addition we observe an increase of the gas temperature from 30−35 K in the surrounding up to 40−45 K towards the ionization front, most likely due to the UV radiation from the external star. Furthermore, detailed models of the temperature structure close to IRS 1 which take the known density gradient into account show that the gas is warmer and/or denser than what we model. Finally, modelling of the dust emission from the sub-mm peak SMM 1 constrains its luminosity to a few ×10 2 L . Conclusions. We conclude that the gas heating in the S 140 region is very efficient even at high densities. The most likely explanation is deep UV penetration from the embedded sources in a clumpy medium and/or oblique shocks.