ObjectiveThis study was conducted to examine the association between the A118G polymorphism of theOPRM1gene and the risk of increased VAS scores in patients with colorectal cancer who underwent laparoscopic radical resection for which fentanyl was used.MethodsTheOPRM1A118G genotype in subjects were detected. The relationship between the A118G polymorphism of theOPRM1gene and increased Visual Analogue Scale (VAS) scores throughout the perioperative period was explored. A total of 101 patients receiving fentanyl anesthesia undergoing laparoscopic radical resection of colon tumors at Zhongshan Hospital, Fudan University between July 2018 and December 2020 were investigated in the present study. The relative risk between the A118G polymorphism of theOPRM1gene and VAS ≥ 4 in the PACU was estimated using the adjusted effect relationship diagram, baseline characteristic analysis, and multiple logistic regression analysis. The relationship between the A118G polymorphism of theOPRM1gene and VAS in the PACU, as well as perioperative fentanyl usage, was examined after confounders were adjusted.ResultsSubjects withOPRM1A118G wild gene A were less sensitive to fentanyl, which was a risk factor for PACU VAS ≥ 4. Before the model was adjusted, the odds ratio (OR) was 14.73 (P= 0.001). After adjusting for age, sex, weight, height, and the duration of surgery, the OR increased to 16.55 (P= 0.001). When adjusting for age, sex, weight, height, surgery duration,COMTVal158Met gene polymorphism,CYP3A4*1G gene polymorphism, andCYP3A5*3gene polymorphism, the OR was 19.94 (P= 0.002). Moreover,OPRM1A118G wild type gene A was found to be a risk factor for increased dosage of fentanyl in the PACU. Before the model was adjusted, the OR reached 16.90 (P= 0.0132). After adjusting for age, sex, body weight, intraoperative fentanyl dosage, surgery duration, and height, the OR was 13.81, (P= 0.0438). When adjusting for age, sex, weight, height, intraoperative fentanyl dosage, surgery duration,COMTVal158Met gene polymorphism,CYP3A4*1G gene polymorphism, andCYP3A5*3 gene polymorphism, the OR reached 15.23, (P= 0.0205).ConclusionThe A118G polymorphism of theOPRM1gene carrying wild gene A was a risk factor for VAS ≥ 4 in the PACU. Moreover, it is a risk factor for increased dosage of fentanyl in the PACU.Supplementary InformationThe online version contains supplementary material available at 10.1186/s12871-023-02120-1.