Background: Urinary catheterization frequently leads to catheter-related bladder discomfort (CRBD) in male patients after general anesthesia. This prospective cohort trial aimed to prove the efficacy of unilateral ilioinguinal transversus abdominis plane block (TAPB) in attenuating CRBD in male patients. Methods: Male patients with a severe CRBD were randomized to receive unilateral ilioinguinal TAPB with 0.375% ropivacaine 10 mL (group T) or intravenous sufentanil 0.15 μg/kg (group C). The primary outcomes were the incidence rates of moderate-to-severe CRBD at 0.5, 1, 2, and 6 hours after treatment, and the other outcomes were postoperative adverse events related to treatments. Results: The incidence rates of moderate-to-severe CRBD were significantly lower in group T than in group C at 0.5 hours (11.5% vs 87.4%, P<0.001), 1 hour (7.6% vs 92.3%, P=0.001), 2 hours (7.6% vs 92.3%, P=0.001), and 6 hours (11.5% vs 100%, P<0.001) after treatment. The postoperative incidences of sedation and respiratory depression were decreased significantly in group T compared to group C (P<0.05). Conclusions: Unilateral ilioinguinal TAPB with ropivacaine can decrease the incidence of moderate-to-severe CRBD and reduce side effects in male patients after general anesthesia compared to intravenous sufentanil administration. Trial registration: This trial was registered with Clinicaltrials.gov as ChiCTR1900022869 on April 29, 2019, http://www.chictr.org.cn/showproj.aspx?proj=38516.