The immune system plays an instrumental role in obesity and insulin resistance. Here, we unravel the role of the costimulatory molecule CD40 and its signaling intermediates, TNF receptor-associated factors (TRAFs), in diet-induced obesity (DIO). Although not exhibiting increased weight gain, male CD40(-/-) mice in DIO displayed worsened insulin resistance, compared with wild-type mice. This worsening was associated with excessive inflammation of adipose tissue (AT), characterized by increased accumulation of CD8(+) T cells and M1 macrophages, and enhanced hepatosteatosis. Mice with deficient CD40-TRAF2/3/5 signaling in MHCII(+) cells exhibited a similar phenotype in DIO as CD40(-/-) mice. In contrast, mice with deficient CD40-TRAF6 signaling in MHCII(+) cells displayed no insulin resistance and showed a reduction in both AT inflammation and hepatosteatosis in DIO. To prove the therapeutic potential of inhibition of CD40-TRAF6 in obesity, DIO mice were treated with a small-molecule inhibitor that we designed to specifically block CD40-TRAF6 interactions; this compound improved insulin sensitivity, reduced AT inflammation, and decreased hepatosteatosis. Our study reveals that the CD40-TRAF2/3/5 signaling pathway in MHCII(+) cells protects against AT inflammation and metabolic complications associated with obesity whereas CD40-TRAF6 interactions in MHCII(+) cells aggravate these complications. Inhibition of CD40-TRAF6 signaling by our compound may provide a therapeutic option in obesity-associated insulin resistance.