Solid tumours are innervated by nerve fibres that arise from the autonomic and sensory peripheral nervous systems1-5. Whether the neo-innervation of tumours by pain-initiating sensory neurons affects cancer immunosurveillance remains unclear. Here we show that melanoma cells interact with nociceptor neurons, leading to increases in their neurite outgrowth, responsiveness to noxious ligands and neuropeptide release. Calcitonin gene-related peptide (CGRP)-one such nociceptor-produced neuropeptide-directly increases the exhaustion of cytotoxic CD8+ T cells, which limits their capacity to eliminate melanoma. Genetic ablation of the TRPV1 lineage, local pharmacological silencing of nociceptors and antagonism of the CGRP receptor RAMP1 all reduced the exhaustion of tumour-infiltrating leukocytes and decreased the growth of tumours, nearly tripling the survival rate of mice that were inoculated with B16F10 melanoma cells. Conversely, CD8+ T cell exhaustion was rescued in sensory-neuron-depleted mice that were treated with local recombinant CGRP. As compared with wild-type CD8+ T cells, Ramp1-/- CD8+ T cells were protected against exhaustion when co-transplanted into tumour-bearing Rag1-deficient mice. Single-cell RNA sequencing of biopsies from patients with melanoma revealed that intratumoral RAMP1-expressing CD8+ T cells were more exhausted than their RAMP1-negative counterparts, whereas overexpression of RAMP1 correlated with a poorer clinical prognosis. Overall, our results suggest that reducing the release of CGRP from tumour-innervating nociceptors could be a strategy to improve anti-tumour immunity by eliminating the immunomodulatory effects of CGRP on cytotoxic CD8+ T cells.