Recent clinical trials showed that targeting of inhibitory receptors on T cells induces durable responses in a subset of cancer patients, despite advanced disease. However, the regulatory switches controlling T-cell function in immunosuppressive tumours are not well understood. Here we show that such inhibitory mechanisms can be systematically discovered in the tumour microenvironment. We devised an in vivo pooled short hairpin RNA (shRNA) screen in which shRNAs targeting negative regulators became highly enriched in murine tumours by releasing a block on T-cell proliferation upon tumour antigen recognition. Such shRNAs were identified by deep sequencing of the shRNA cassette from T cells infiltrating tumour or control tissues. One of the target genes was Ppp2r2d, a regulatory subunit of the PP2A phosphatase family. In tumours, Ppp2r2d knockdown inhibited T-cell apoptosis and enhanced T-cell proliferation as well as cytokine production. Key regulators of immune function can therefore be discovered in relevant tissue microenvironments.