While public awareness of sleep related disorders is growing, sleep apnea syndrome (SAS) remains a public health and economic challenge. Fueled by the obesity epidemic, in the US alone it is estimated that over 29.4 million adults suffer from sleep apnea, that 80–90% of those adults are living undiagnosed and untreated, and that the aggregate costs of undiagnosed adults with sleep apnea exceed $150 billion annually. Although various devices have been used to measure physiological signals, detect apneic events, and help treat sleep apnea, significant opportunities remain to improve the quality, efficiency, and affordability of sleep apnea care. As our understanding of respiratory and neurophysiological signals and sleep apnea physiological mechanisms continues to grow, and our ability to detect and process biomedical signals improves, novel diagnostic and treatment modalities emerge. This dissertation presents a body of work that establishes the feasibility of using a computer based variable dead space rebreathe device (“Smart CO2”) to treat obstructive and central Sleep apnea. This device has the following characteristics: a) measure ventilation on a breath-by-breath basis to detect the occurrence of sleep apnea and/or hypopnea and b) automatically adjust the rebreathe dead space volume to deliver the minimum amount of CO2 in a step-wise fashion to eliminate or significantly reduce the patient’s apneas and hypopneas. We have tested the accuracy of this current “Smart CO2” device in two ways. First, we used humans and mannequins to quantify, via mathematical modelling, the dynamics of CO2 mixing of inflow gas and dead space air. This “Smart CO2” variable dead space device elicited highly predictable (±3.5% error) alveolar PCO2 levels with changing reservoir dead spaces, thereby ensuring that excessive CO2 accumulation would not occur during rebreathing. Secondly, we developed algorithms that reliably switched the subject into and out of the device with increasing/decreasing levels of rebreathe volume in response to simulated apneas and hypopneas. Based on the findings of this thesis, a “Smart CO2” device that will reliably and accurately—and even comfortably—detect sleep-disordered breathing (SDB) in real time, provide step-wise increments in rebreathe volume and alveolar CO2.