Aims. We aim to constrain the temperature and velocity structures, and H 2 O abundances in the winds of a sample of M-type asymptotic giant branch (AGB) stars. We further aim to determine the effect of H 2 O line cooling on the energy balance in the inner circumstellar envelope. Methods. We use two radiative-transfer codes to model molecular emission lines of CO and H 2 O towards four M-type AGB stars. We focus on spectrally resolved observations of CO and H 2 O from HIFI aboard the Herschel Space Observatory. The observations are complemented by ground-based CO observations, and spectrally unresolved CO and H 2 O observations with PACS aboard Herschel. The observed line profiles constrain the velocity structure throughout the circumstellar envelopes (CSEs), while the CO intensities constrain the temperature structure in the CSEs. The H 2 O observations constrain the o-H 2 O and p-H 2 O abundances relative to H 2 . Finally, the radiative-transfer modelling allows to solve the energy balance in the CSE, in principle including also H 2 O line cooling. Results. The fits to the line profiles only set moderate constraints on the velocity profile, indicating shallower acceleration profiles in the winds of M-type AGB stars than predicted by dynamical models, while the CO observations effectively constrain the temperature structure. Including H 2 O line cooling in the energy balance was only possible for the low-mass-loss-rate objects in the sample, and required an ad hoc adjustment of the dust velocity profile in order to counteract extreme cooling in the inner CSE. H 2 O line cooling was therefore excluded from the models. The constraints set on the temperature profile by the CO lines nevertheless allowed us to derive H 2 O abundances. The derived H 2 O abundances confirm previous estimates and are consistent with chemical models. However, the uncertainties in the derived abundances are relatively large, in particular for p-H 2 O, and consequently the derived o/p-H 2 O ratios are not well constrained.