High levels of HIV stigma as well as stigma directed towards sexual and/or gender minorities (SGMs) are well documented in the African setting. These intersecting stigmas impede psychosocial wellbeing and HIV prevention and care. Yet, there are few if any evidence-based interventions that focus on reducing internalized stigma and promoting mental health and HIV wellness for SGMs in Africa. We developed and evaluated a group-based intervention drawing on cognitive behavioural therapy (CBT) strategies for men who have sex with men (MSM) and transgender women (TGW) at risk for or living with HIV in Lagos, Nigeria. The intervention comprised four weekly in-person group sessions facilitated by community health workers. We conducted a delayed intervention group randomized controlled trial (April-September 2022), with pre-post surveys plus 3-month follow-up (immediate group only), as well as qualitative research with participants and programme staff. Outcomes included internalized stigma related to SGM and HIV status, depression, resiliency/coping and pre-exposure prophylaxis (PrEP)/HIV treatment use. Mean age of the 240 participants was 26 years (range 18-42). Seventy-seven percent self-identified as MSM and 23% TGW; 27% were people with HIV. Most (88%) participants attended all four sessions, and 98% expressed high intervention satisfaction. There was significant pre-post improvement in each psychosocial outcome, in both the immediate and delayed arms. There were further positive changes for the immediate intervention group by 3-month follow-up (e.g. in intersectional internalized stigma, depression). While baseline levels of ever-PrEP use were the same, 75% of immediate-group participants reported currently using PrEP at 3 months post-intervention versus 53% of delayed-group participants right after the intervention (p<0.01). Participants post-intervention described (in qualitative interviews) less self-blame, and enhanced social support and resilience when facing stigma, as well as motivation to use PrEP, and indicated that positive pre-intervention changes in psychosocial factors found in the delayed group mainly reflected perceived support from the study interviewers. This study demonstrated the feasibility and acceptability of a group-based CBT model for MSM and TGW in Nigeria. There were also some indications of positive shifts related to stigma, mental health and PrEP, despite issues with maintaining the randomized design in this challenging environment.