The present invention pertains to a device (1) for ventilating a patient, including an invasive mechanical ventilator (2) for periodically providing a breathing gas to an invasive patient interface (20), wherein a gas injector (4) for injecting nitric oxide supplied by a source of nitric oxide (3) into the breathing gas supplied by the invasive mechanical ventilator (2) is provided.