Resisting or tolerating microbes are alternative strategies to survive infection, but little is known about the evolutionary mechanisms controlling this balance. Here, genomic analyses of anatomically modern humans, extinct Denisovan hominins, and mice revealed a series of missense variants in the immune response inhibitor A20 (encoded by TNFAIP3), substituting non-catalytic residues of the ubiquitin protease domain to diminish IB-dependent phosphorylation and activation of A20. Two A20 variants with partial phosphorylation deficits appeared beneficial: one originating in Denisovans and introgressed in modern humans throughout Oceania, and another in a mouse strain resistant to Coxsackievirus. By contrast, a variant with 95% loss of phosphorylation caused spontaneous inflammatory disease in humans and mice. Analysis of the partial phosphorylation variant in mice revealed diminished tolerance of bacterial lipopolysaccharide or to poxvirus inoculation as trade-offs for enhanced immunity.