Recombination-promoting nuclease (Rpn) proteins are broadly distributed across bacterial phyla, yet their functions remain unclear. Here we report these proteins are new toxin-antitoxin systems, comprised of genes-within-genes, that combat phage infection. We show the small, highly variable RpnC-terminal domains (RpnS), which are translated separately from the full-length proteins (RpnL), directly block the activities of the toxic full-length proteins. The crystal structure of RpnASrevealed a dimerization interface encompassing a helix that can have four amino acid repeats whose number varies widely among strains of the same species. Consistent with strong selection for the variation, we document plasmid-encoded RpnP2LprotectsEscherichia coliagainst certain phages. We propose many more intragenic-encoded proteins that serve regulatory roles remain to be discovered in all organisms.