A method and device for treating sleep apnea and sleep hypopnea by monitoring respiratory-related activity from the internal branch of the superior laryngeal nerve, interpreting these internal signals to detect and classify apnea events, and stimulating nerves or muscles to elicit appropriate corrective responses to adverse respiratory events.