The present invention relates to a ventilator (5) having a flow generator (10,20), a controller (40), and a flow sensor (120), the controller controlling the flow generator to generate a flow of breathable gas, providing an expiratory pressure and a higher inspiratory pressure, and an adjustable rate of change of the expiratory pressure to the higher inspiratory pressure, whereby on detecting an event of upper airway instability, the rate of change is decreased.