The invention relates to a device for the regulation of PEEP and FiO2 of a ventilator for achieving an arterial oxygen partial pressure in the blood of a mechanically ventilated patient. At reading which is representative of the success of the oxygen supply, i.e. the oxygen saturation of the blood is measured with the device, and assigned to one of three regions, which are defined by two characteristic lines. A first control loop is designed to optimise PEEP and FiO2 on assigning a reading to a region which demands a change of the settings, or to retaining the settings with an assignment to the normal region between the characteristic lines. This first control loop carries out such an optimisation at predefined temporal intervals on account of the representative reading (SaO2REP) and a predefined necessary supply intensity. The ventilator is subsequently activated accordingly. Therebetween, if necessary only FiO2 is increased or reduced with a second control loop, if between optimisations by way of the first control loop, the current representative value (SaO2REP) falls below a limit value (characteristic line) which is dependent on the supply intensity, which demands an immediate increase of the oxygen supply.