Surgical patients often experience intraoperative hypothermia or hyperthermia. However, the relationship of intraoperative hypothermia and hyperthermia with postoperative pulmonary infection (PPI) and surgical site infection (SSI) is unclear. Here, we conducted a retrospective cohort study to address these issues. Adult patients who underwent major non-cardiac surgery under general anesthesia were eligible for the study and were recruited. Three indices of core body temperature under hypothermia (<36°C) and hyperthermia (>37.3°C) were calculated as mentioned in the following: absolute value (0C), duration of exposure (min), and area under the curve (AUC,°C× min). The outcomes were in-hospital PPI and SSI. The risk-adjusted association of intraoperative hypothermia and hyperthermia with PPI and SSI was determined. The absolute value (the nadir value of hypothermia and the peak value of hyperthermia) was not associated with PPI and SSI. PPI was associated with (1) duration: hypothermia >90 min [adjusted odds ratio (aOR): 1.425, 95% confidence interval (CI): 1.131-1.796] and hyperthermia >75 min (aOR: 1.395, 95%CI: 1.208-1.612) and (2) AUC: hypothermia >3,198 (aOR: 1.390, 95%CI: 1.128-1.731) and hyperthermia >7,945 (aOR: 2.045, 95%CI: 1.138-3.676). SSI was associated with (1) duration: hypothermia > 195 min (aOR: 2.900, 95%CI: 1.703-4.937) and hyperthermia >75 min (aOR: 1.395, 95%CI: 1.208-1.612) and (2) AUC: hypothermia >6,946 (aOR: 2.665, 95%CI: 1.618-4.390), hyperthermia >7,945 (aOR: 2.619, 95%CI: 1.625-4.220). Interactions were not observed between hyperthermia and hypothermia on the outcomes. It was observed that intraoperative hypothermia and hyperthermia are associated with postoperative pulmonary infection and surgical site infection in major non-cardiac surgery.