The present invention relates to a patient interface (10) for delivering a flow of breathable gas to a patient (12), comprising: a sealing portion (22) for sealing an interface between the patient interface (10) and a patient's face when the patient (10) interface is worn by the patient (12); a detection unit (30) including a displacement sensor (32, 32′) for generating a displacement signal including information on a displacement of the sealing portion (22) with respect to the patient's face relative to an identified reference position of the sealing portion (22) with respect to the patient's face; one or more actuators (36, 36′, 36″) for positioning at least parts of the sealing portion (22) relative to the patient's face; and a control unit (34) that is configured to actuate the one or more actuators (36, 36′, 36″) based on the displacement signal in order to adjust a position of at least parts of the sealing portion (22) with respect to the patient's face during use.