Obstructive sleep apnea (OSA) is common in surgical patients and associated with worse perioperative outcomes. To investigate the effect of mini-dose dexmedetomidine supplemented analgesia on postoperative sleep quality pattern in patients at high risk of OSA. A pilot randomized, double-blind, placebo-controlled trial. A tertiary university hospital in Beijing, China. One hundred and fifty-two adult patients who had a STOP-Bang score ≥3 and a serum bicarbonate level ≥28 mmol/L and were scheduled for major noncardiac surgery between 29 January 2021 and 20 September 2022. After surgery, patients were provided with high-flow nasal cannula and randomized in a 1:1 ratio to receive self-controlled opioid analgesia supplemented with either mini-dose dexmedetomidine (median 0.02 μg/kg/h) or placebo. We monitored polysomnogram from 9:00 pm to 6:00 am during the first night. Our primary outcome was the percentage of stage 2 non-rapid eye movement (N2) sleep. Secondary and exploratory outcomes included other postoperative sleep structure parameters, sleep-respiratory parameters, and subjective sleep quality (Richards-Campbell Sleep Questionnaire; 0-100 score range, higher score better). All 152 patients were included in intention-to-treat analysis; 123 patients were included in sleep structure analysis. Mini-dose dexmedetomidine supplemented analgesia increased the percentage of stage N2 sleep (median difference, 10%; 95% CI, 1 to 21%; p = 0.029); it also decreased the percentage of stage N1 sleep (median difference, -10%; 95% CI, -20% to -1%; p = 0.042). Other sleep structure and sleep-respiratory parameters did not differ significantly between the two groups. Subjective sleep quality was slightly improved with dexmedetomidine on the night of surgery, but not statistically significant (median difference, 6; 95% CI, 0 to 13; p = 0.060). Adverse events were similar between groups. Among patients at high risk of OSA who underwent noncardiac surgery, mini-dose dexmedetomidine supplemented analgesia may improve sleep quality without increasing adverse events. Clinicaltrials.gov, identifier NCT04608331.