A system and method of providing bi-level CPAP therapy is provided that incorporates an infrared carbon-dioxide sensor to determine whether a patient is inhaling or exhaling. Patient exhalation causes the infrared light to be absorbed, while patient inhalation reduces the presence of carbon-dioxide causes little or no absorption of carbon-dioxide. The level of carbon-dioxide in an associated patient breathing interface is monitored for thresholds that trigger higher CPAP pressure upon inhalation and lower CPAP pressure upon exhalation.