Although both nonsteroidal anti-inflammatory drugs (NSAIDs) and opioids are used for analgesia in acute pancreatitis (AP), the analgesic of choice is not known. We compared buprenorphine, an opioid, and diclofenac, an NSAID, for analgesia in AP. In a double-blind randomized controlled trial, AP patients were randomized to receive intravenous diclofenac or intravenous buprenorphine. Fentanyl was used as rescue analgesia, delivered through a patient-controlled analgesia pump. Primary outcome was the difference in the dose of rescue fentanyl required. Secondary outcomes were the number of effective and ineffective demands of rescue fentanyl, pain-free interval, reduction in visual analogue scale (VAS) score, adverse events, and organ failure development. Twenty-four patients were randomized to diclofenac and 24 to buprenorphine. The 2 groups were matched at baseline. The total amount of rescue fentanyl required was significantly lower in the buprenorphine group:130 μg, interquartile range (IQR), 80-255 vs 520 μg, IQR, 380-1065 (P < .001). The number of total demands was 32 (IQR, 21-69) in the diclofenac arm vs 8 (IQR, 4-15) in the buprenorphine arm (P < .001). The buprenorphine group had more prolonged pain-free interval (20 vs 4 hours; P < .001), with greater reduction in the VAS score at 24, 48, and 72 hours compared with the diclofenac group. These findings were confirmed in the subgroup of moderately severe/severe pancreatitis. Adverse events profile was similar in the 2 groups. Compared with diclofenac, buprenorphine appears to be more effective and equally safe for pain management in AP patients, even in the subcohort of moderately severe or severe pancreatitis (Trial Registration number: CTRI/2020/07/026914).