In humans, TGFβ signalling is associated with lack of response to immunotherapy in immune-excluded tumours; in mouse models of this immune phenotype, robust tumour infiltration by T cells and tumour regression are observed only when checkpoint inhibition is combined with inhibition of TGFβ signalling. Immune checkpoint blockade is showing clinical promise in the treatment of several cancer types, but the determinants of response need to be better established. Sanjeev Mariathasan and colleagues show that specific immune cell phenotypes and a high neoantigen burden are predictors of good responses to therapy with atezolizumab, an anti-PD-L1 agent, in patients with metastatic urothelial carcinoma. Lack of response to therapy is associated with increased TGFβ signalling in fibroblasts in the tumour microenvironment. Combining TGFβ blockade with immune checkpoint blockade in mouse models increases the anti-tumour efficacy of the therapy, suggesting that identifying and targeting microenvironmental regulators of anti-tumour immunity may increase the reach of immunotherapy approaches. Therapeutic antibodies that block the programmed death-1 (PD-1)–programmed death-ligand 1 (PD-L1) pathway can induce robust and durable responses in patients with various cancers, including metastatic urothelial cancer1,2,3,4,5. However, these responses only occur in a subset of patients. Elucidating the determinants of response and resistance is key to improving outcomes and developing new treatment strategies. Here we examined tumours from a large cohort of patients with metastatic urothelial cancer who were treated with an anti-PD-L1 agent (atezolizumab) and identified major determinants of clinical outcome. Response to treatment was associated with CD8+ T-effector cell phenotype and, to an even greater extent, high neoantigen or tumour mutation burden. Lack of response was associated with a signature of transforming growth factor β (TGFβ) signalling in fibroblasts. This occurred particularly in patients with tumours, which showed exclusion of CD8+ T cells from the tumour parenchyma that were instead found in the fibroblast- and collagen-rich peritumoural stroma; a common phenotype among patients with metastatic urothelial cancer. Using a mouse model that recapitulates this immune-excluded phenotype, we found that therapeutic co-administration of TGFβ-blocking and anti-PD-L1 antibodies reduced TGFβ signalling in stromal cells, facilitated T-cell penetration into the centre of tumours, and provoked vigorous anti-tumour immunity and tumour regression. Integration of these three independent biological features provides the best basis for understanding patient outcome in this setting and suggests that TGFβ shapes the tumour microenvironment to restrain anti-tumour immunity by restricting T-cell infiltration.