The clinical course of autoimmune and infectious disease varies greatly, even between individuals with the same condition. An understanding of the molecular basis for this heterogeneity could lead to significant improvements in both monitoring and treatment. During chronic infection the process of T-cell exhaustion inhibits the immune response, facilitating viral persistence. Here we show that a transcriptional signature reflecting CD8 T-cell exhaustion is associated with poor clearance of chronic viral infection, but conversely predicts better prognosis in multiple autoimmune diseases. The development of CD8 T-cell exhaustion during chronic infection is driven both by persistence of antigen and by a lack of accessory 'help' signals. In autoimmunity, we find that where evidence of CD4 T-cell co-stimulation is pronounced, that of CD8 T-cell exhaustion is reduced. We can reproduce the exhaustion signature by modifying the balance of persistent stimulation of T-cell antigen receptors and specific CD2-induced co-stimulation provided to human CD8 T cells in vitro, suggesting that each process plays a role in dictating outcome in autoimmune disease. The 'non-exhausted' T-cell state driven by CD2-induced co-stimulation is reduced by signals through the exhaustion-associated inhibitory receptor PD-1, suggesting that induction of exhaustion may be a therapeutic strategy in autoimmune and inflammatory disease. Using expression of optimal surrogate markers of co-stimulation/exhaustion signatures in independent data sets, we confirm an association with good clinical outcome or response to therapy in infection (hepatitis C virus) and vaccination (yellow fever, malaria, influenza), but poor outcome in autoimmune and inflammatory disease (type 1 diabetes, anti-neutrophil cytoplasmic antibody-associated vasculitis, systemic lupus erythematosus, idiopathic pulmonary fibrosis and dengue haemorrhagic fever). Thus, T-cell exhaustion plays a central role in determining outcome in autoimmune disease and targeted manipulation of this process could lead to new therapeutic opportunities.