T cell activation is a highly regulated process involving peptide-MHC engagement of the T cell receptor and positive costimulatory signals. Upon activation, coinhibitory 'checkpoints', including programmed cell death protein 1 (PD1), become induced to regulate T cells. PD1 has an essential role in balancing protective immunity and immunopathology, homeostasis and tolerance. However, during responses to chronic pathogens and tumours, PD1 expression can limit protective immunity. Recently developed PD1 pathway inhibitors have revolutionized cancer treatment for some patients, but the majority of patients do not show complete responses, and adverse events have been noted. This Review discusses the diverse roles of the PD1 pathway in regulating immune responses and how this knowledge can improve cancer immunotherapy as well as restore and/or maintain tolerance during autoimmunity and transplantation.