Background: Adding dexmedetomidine to bupivacaine has been shown to prolong the analgesic effects of the transversus abdominis plane (TAP) block. However, the optimal dose of this adjuvant drug is unclear. Objectives: Identifying optimal doses of dexmedetomidine added to bupivacaine in the TAP block. Methods: In this randomized controlled trial, 86 patients candidate for elective open inguinal herniorrhaphy under spinal anesthesia were divided randomly into three groups; low (L), medium (M), and high (H) dose of dexmedetomidine, that finally 80 cases ended the study and were analyzed. At the end of the surgery, the patients underwent ultrasound-guided TAP block. In all patients of the three groups, the analgesic base of the block was 20 mL bupivacaine 0.125% that was supplemented with 0.5, 1, or 1.5 µ/kg of dexmedetomidine in groups L, M, and H, respectively. Results: The maximum duration of the block was 4 hours in group L and 8 hours in groups M and H. None of the patients needed to receive analgesic at 0, 2, and 24 hours after the block. The dose of analgesic required in the first 8 hours of the block in groups M and H was less than in group L (P < 0.02). Patients in groups H and M were more satisfied with the block (P < 0.01) and experienced less pain compared with group L (P < 0.01). Drowsiness and sedation were observed in patients up to 4 hours after the TAP block, which was dependent on the dexmedetomidine dose (P < 0.01). Conclusions: Based on our results, the optimal dose of supplemental dexmedetomidine could be 1 µ/kg in the TAP block.