Background Bariatric surgery is often associated with moderate to severe pain. In patients with obesity, opioids have the potential to induce ventilatory impairment; thus, opioid use needs to be limited. This study aimed to compare the novel ultrasound-guided erector spinae plane block (ESPB) technique with controls in terms of intraoperative opioid consumption and postoperative pain control. Methods A total of 63 patients with morbid obesity who underwent laparoscopic bariatric surgery were included in this randomized study. Patients were randomly assigned to the bilateral erector spinae plane block (ESPB) group or the control group. To evaluate perioperative pain and to adjust opioid dose, analgesia nociception index (ANI) was monitored during surgery. Total opioid dose was recorded for each patient. In addition, pain was evaluated using visual analogue scale (VAS) scores for 24 h following the operation. Results Total intraoperative remifentanil dose was significantly lower in the ESPB group when compared to controls (1356.3 +/- 177.8 vs. 3273.3 +/- 961.9 mcg, p < 0.001). In the ESPB group, none of the patients required additional analgesia during follow-up. In contrast, all control patients required analgesia. ESPB group had significantly lower VAS scores at all postoperative time points (p < 0.001 for all). Conclusion Bilateral ultrasound-guided ESPB appears to be a simple and effective technique to improve perioperative pain control and reduce intraoperative opioid need in patients with morbid obesity undergoing bariatric surgery.