Ideally, you should use a CPAP machine for sleep apnea for the entire duration of your sleep. However, many people have difficulty using it all night. Research suggests the sleep apnea machine should be used for at least six hours a night to reap the benefits.