Background Chronic postsurgical pain (CPSP) in elderly patients negatively impacts recovery, quality of life, and physical functioning. This study aimed to test parecoxib's superiority versus placebo in combination with epidural anesthesia in preventing chronic post-hepatectomy pain in elderly patients.Methods One hundred and five elderly patients undergoing hepatectomy were randomized to the parecoxib group or placebo group combined with epidural anesthesia. The primary outcome was the proportion of patients with CPSP at postoperative three months. The secondary outcomes included the Short-Form McGill Pain Questionnaire score in CPSP-positive responders, acute pain intensity, postoperative analgesic demand, inflammatory markers change, and postoperative complications within 28 days. Results The parecoxib group provided a non-significant absolute 9.1% reduction in the rate of CPSP compared with the placebo group (35.3% vs. 44.4%, P=0.34). The average chronic pain verbal analog scale in the parecoxib group was lower than that in the placebo group (median (IQR) 2(1, 2) vs. 3 (2, 3), P=0.04). Significantly less moderate-to-severe acute pain at rest (4.3% vs. 17.3%, P=0.04) and with coughing (32.6% vs. 73.1%, P<0.001), less patient-controlled epidural analgesia (PCEA) consumption ( 197.4±43.6mL vs. 219.2±42.4mL, P=0.01) and less rescue analgesia (median (IQR) 0 (0, 0) vs. 1 (0, 2), P<0.001) were observed in parecoxib group. Furthermore, there was no between-group difference in inflammatory markers (P>0.05) and postoperative complications (11.8% vs.14.8%, P=0.65).Conclusions Parecoxib reduced the prevalence of CPSP in elderly patients undergoing hepatectomy under epidural analgesia from 44.4% to 35.3% with no statistical significance. Meanwhile, significantly alleviated CPSP intensity and improved acute pain management were observed.Trial Registration This study was retrospectively registered in the Chinese Clinical Trial Registry (URL: http://www.chictr.org.cn/edit.aspx?pid=56961&htm=4) on August 3, 2020 (ChiCTR-2000035198).