The present invention relates to a method and a system for controlling breathing of a patient. A mixing device extends from a patient interface to control a volume of exhaled gasses. The mixing device has a first orifice connected to and in fluid communication with a first control tube and terminating in a first variable flow control valve and a second orifice connected to and in fluid communication with a second control tube and terminating in a second variable flow control valve. Further a first volume extends between the first and second orifices. A controller then controls the volume of exhaled gasses from the patient using the first and second variable flow control valves.