Opioids are effective for acute pain management following surgery among adolescents, yet are associated with significant negative consequences, including respiratory depression and opioid misuse. Sleep deficiency is common following surgery and extant research indicates strong cross-sectional associations between sleep deficiency and increased problematic opioid use. This study examined longitudinal associations between postsurgical sleep deficiency and opioid use among adolescents undergoing outpatient surgery. We also examined daily pain and mood as mechanisms linking previous night's sleep deficiency and next day prescription opioid use. This prospective, observational study enrolled 106 adolescents (11-19 years) who underwent orthopedic outpatient surgery and collected pre-surgery and longitudinal measurements. Participants were 52% female, African-American (7%), American Indian/Alaska Native (7%), Hispanic (9%), Native Hawaiian or Other Pacific Islander (4%), or white, non-Hispanic (66%). Using ecological momentary assessment methods, participants reported sleep, pain, and mood in real time over the first 14 days following surgery. Postsurgical opioid use was measured using an electronic medication cap monitoring device, eCAPTM. Associations between variables were measured using multilevel structural equation modeling. Using multi-level mediation models, pain, but not mood-mediated associations between postsurgical sleep deficiency (sleep quality, total sleep time, sleep onset latency, and wake after sleep onset) and opioid use, at both the within-person and between-person levels. Results highlight that greater previous night's sleep deficiency (both generally and greater than a person's mean level) was associated with higher next day pain (both generally and greater than a person's mean level), which, in turn, was associated with higher opioid use. Furthermore, between-person total effect models provide support for sleep deficiency predicting higher opioid use. Our findings should be considered preliminary yet underscore the need for a comprehensive and personalized approach to postsurgical pain management and opioid use, potentially implementing interventions targeting sleep quality and quantity to reduce pain and opioid use.