AimTo investigate the effects of penehyclidine hydrochloride combined with dexmedetomidine on pulmonary function in patients undergoing heart valve surgery with cardiopulmonary bypass (CPB).MethodsA total of 180 patients undergoing elective heart valve surgery with CPB were randomly divided into four groups: 45 in group P (intravenous penehyclidine hydrochloride 0.02 mg/kg 10 min before anesthesia induction and at the beginning of CPB, total 0.04 mg/kg); 43 in group D (dexmedetomidine 0.5 μg/kg/h after induction of anesthesia until the end of anesthesia); 44 in group PD ( penehyclidine hydrochloride 0.04 mg/kg combined with dexmedetomidine 0.5 μg/kg/h intravenously during anesthesia); and 43 in group C (same amount of normal saline 10 min before and after anesthesia induction, to the end of anesthesia, and at the beginning of CPB). The main outcomes were the incidence and severity of postoperative pulmonary complications (PPCs). The secondary outcomes were: (1) extubation time, length of stay in intensive care, and postoperative hospital stay, and adverse events; and (2) pulmonary function evaluation indices (oxygenation index and respiratory index) and plasma inflammatory factor concentrations (tumor necrosis factor-α, interleukin-6, C-reactive protein and procalcitonin) during the perioperative period.ResultsThe incidence of PPCs in groups P, D and PD after CPB was lower than that in group C (P< 0.05), and the incidence in group PD was significantly lower than that in groups P and D (P< 0.05). The scores for PPCs in groups P, D and PD were lower than those in group C (P< 0.05).ConclusionCombined use of penehyclidine hydrochloride and dexmedetomidine during anesthesia reduced the occurrence of postoperative pulmonary dysfunction, and improved the prognosis of patients undergoing heart valve surgery with CPB.Trial registrationThe trial was registered in the Chinese Clinical Trial Registry on 3/11/2020 (Registration No.: ChiCTR2000039610).Supplementary InformationThe online version contains supplementary material available at 10.1186/s12871-023-02176-z.