Sufficient propofol or fentanyl doses necessary to prevent the response to skin incision do not necessarily reduce hemodynamic responses during surgery. The purpose of this study was to characterize the pharmacodynamic interaction between propofol and fentanyl with respect to the sedative effects and safety during painless gastrointestinal endoscopy. From October 2018 to October 2020, 200 patients undergoing painless gastrointestinal endoscopy in our department’s outpatient or inpatient clinic were selected and randomly divided into a control group and an observation group, 100 patients per group. Prior to surgery, the patients in the two groups were required to be connected to an electrocardiogram monitor and then were instructed to lie on the left side and receive continuous oxygen infusion of 2-3 L/min with a nasal cannula. The control group was injected with propofol injection (100 mg/min). The observation group was given fentanyl intravenous injection at a dose of 0.1 μg/kg followed by propofol injection (100 mg/min). Painless gastrointestinal endoscopy was performed after the patients entered a sleep state and the eyelash reaction disappeared. Outcome analysis was performed on preoperative and intraoperative hemodynamic indicators, including heart rate, blood oxygen saturation, dose of propofol, time for endoscopy, recovery time, hospitalization after recovery, Montreal Cognitive Assessment (MoCA) score, and Mini-Mental State Examination (MMSE) score. The incidence rate of adverse reactions in the observation group was 6%, which was notably lower than that of the control group (18%). The total response rate of the observation group was 98%, which was significantly higher than that of the control group (90%) ( P < 0.05 ). The intraoperative heart rate and blood oxygen saturation of the observation group were higher than those of the control group ( P < 0.0 ss ). The patients receiving sedation with propofol plus fentanyl had fewer doses of propofol and shorter recovery time than those receiving propofol alone ( P < 0.05 ). It was also revealed that the patients receiving sedation with propofol plus fentanyl exhibited more MoCA and MMSE scores than those receiving propofol alone 30 min after sedation during painless gastrointestinal endoscopy. Taken together, sedation with propofol combined with fentanyl was more effective and safer than that with propofol alone in painless gastrointestinal endoscopy, which can ensure a wake-up state, stable breathing cycle, and better gastrointestinal painless procedure.