Migraine is a major pediatric health problem impacting 10-12% of youth. About 1 in 3 youth with migraine are diagnosed with insomnia. Sleep and migraine share a cyclical relationship, and data indicate that insomnia symptoms increase migraine severity. CBT for insomnia (CBT-I) has demonstrated efficacy for improving insomnia in adults with migraine and other pain conditions; however, effects in youth have not been evaluated. Moreover, in adults, there is some indication that CBT-I may lead to changes in pain after there are sustained improvements in sleep, but this has never been empirically tested. Cognitive-behavioral therapy for pain management (CBT-Pain) is an established treatment approach for youth with migraine, leading to reductions in headache frequency and disability. In the proposed study, we will address these gaps in knowledge by using an innovative two-phase trial design to (1) test the efficacy of Internet-delivered CBT-I intervention for youth with migraine and comorbid insomnia compared to Internet-delivered sleep education for modifying sleep and (2) investigate how changes in sleep may modify the response to Internet-delivered CBT-Pain intervention.