Patients with prostate cancer frequently show resistance to androgen-deprivation therapy, a condition known as castration-resistant prostate cancer (CRPC). Acquiring a better understanding of the mechanisms that control the development of CRPC remains an unmet clinical need. The well-established dependency of cancer cells on the tumour microenvironment indicates that the microenvironment might control the emergence of CRPC. Here we identify IL-23 produced by myeloid-derived suppressor cells (MDSCs) as a driver of CRPC in mice and patients with CRPC. Mechanistically, IL-23 secreted by MDSCs can activate the androgen receptor pathway in prostate tumour cells, promoting cell survival and proliferation in androgen-deprived conditions. Intra-tumour MDSC infiltration and IL-23 concentration are increased in blood and tumour samples from patients with CRPC. Antibody-mediated inactivation of IL-23 restored sensitivity to androgen-deprivation therapy in mice. Taken together, these results reveal that MDSCs promote CRPC by acting in a non-cell autonomous manner. Treatments that block IL-23 can oppose MDSC-mediated resistance to castration in prostate cancer and synergize with standard therapies. © 2018 Macmillan Publishers Ltd., part of Springer Nature.