Inflammation that is mediated by immune cells can contribute to the pathogenesis of obesity and diabetes. This study showed that blocking the interaction between CD40, a receptor found on immune cells, and the signalling mediator TRAF6 (TNF receptor-associated factor 6) could be a new way to target insulin resistance. Treatment of diet-induced obese mice with a small-molecule inhibitor of the CD40–TRAF6 interaction improved insulin sensitivity, reduced inflammation in adipose tissue and decreased hepatosteatosis.