Cough is a common complication during emergence, which can leads to serious consequences. In this prospective, randomized, double-blind trial, 111 patients were randomly assigned to remimazolam (A), dexmedetomidine (B), control (C). A total of 111 patients were analyzed. There was a significant difference in the incidence of coughing among group A, B and C (37.84% vs. 67.57% vs. 91.89%; adjusted P < 0.001, P = 0.01, and P = 0.009, respectively). The incidence of moderate and severe cough was also lower in group A than that of group B and C (8.11% vs. 35.14% vs. 67.57%; adjusted P < 0.001). The recovery time and extubation time were longer in group B than those of group A and C (adjusted P < 0.001). The RSS scores at the time of eye opening or response, extubation and 5 min after extubation were higher in group B than those of group A and C (adjusted P = 0.002 and P = 0.007, respectively). The HR in patients of group B was reduced after intervention for a long period. Continuous infusion remimazolam lowers the incidence of cough during emergence from general anesthesia, and reduce the severity in patients treated with thyroid surgeries, which does not prolong recovery time and increase the incidence of adverse advents.