The humoral and T-cell responses to booster COVID-19 vaccine types in multidisease immunocompromised individuals who do not generate adequate antibody responses to two COVID-19 vaccine doses, is not fully understood. The OCTAVE DUO trial aimed to determine the value of third vaccinations in a wide range of patients with primary and secondary immunodeficiencies. OCTAVE-DUO was a prospective, open-label, multicentre, randomised, controlled, phase 3 trial investigating humoral and T-cell responses in patients who are immunocompromised following a third vaccine dose with BNT162b2 or mRNA-1273, and of NVX-CoV2373 for those with lymphoid malignancies. We recruited patients who were immunocompromised from 11 UK hospitals, aged at least 18 years, with previous sub-optimal responses to two doses of SARS-CoV-2 vaccine. Participants were randomly assigned 1:1 (1:1:1 for those with lymphoid malignancies), stratified by disease, previous vaccination type, and anti-spike antibody response following two doses. Individuals with lived experience of immune susceptibility were involved in the study design and implementation. The primary outcome was vaccine-specific immunity defined by anti-SARS-CoV-2 spike antibodies (Roche Diagnostics UK and Ireland, Burgess Hill, UK) and T-cell responses (Oxford Immunotec, Abingdon, UK) before and 21 days after the third vaccine dose analysed by a modified intention-to-treat analysis. The trial is registered with the ISRCTN registry, ISRCTN 15354495, and the EU Clinical Trials Register, EudraCT 2021-003632-87, and is complete. Between Aug 4, 2021 and Mar 31, 2022, 804 participants across nine disease cohorts were randomly assigned to receive BNT162b2 (n=377), mRNA-1273 (n=374), or NVX-CoV2373 (n=53). 356 (45%) of 789 participants were women, 433 (55%) were men, and 659 (85%) of 775 were White. Anti-SARS-CoV-2 spike antibodies measured 21 days after the third vaccine dose were significantly higher than baseline pre-third dose titres in the modified intention-to-treat analysis (median 1384 arbitrary units [AU]/mL [IQR 4·3-7990·0] compared with median 11·5 AU/mL [0·4-63·1]; p<0·001). Of participants who were baseline low responders, 380 (90%) of 423 increased their antibody concentrations to more than 400 AU/mL. Conversely, 166 (54%) of 308 baseline non-responders had no response after the third dose. Detectable T-cell responses following the third vaccine dose were seen in 494 (80%) of 616 participants. There were 24 serious adverse events (BNT612b2 eight [33%] of 24, mRNA-1273 12 [50%], NVX-CoV2373 four [17%]), two (8%) of which were categorised as vaccine-related. There were seven deaths (1%) during the trial, none of which were vaccine-related. A third vaccine dose improved the serological and T-cell response in the majority of patients who are immunocompromised. Individuals with chronic renal disease, lymphoid malignancy, on B-cell targeted therapies, or with no serological response after two vaccine doses are at higher risk of poor response to a third vaccine dose. Medical Research Council, Blood Cancer UK.