Parasitoids introduce various virulence factors when parasitism occurs, and some taxa generate teratocytes to manipulate the host immune system and metabolic homeostasis for the survival and development of their progeny. Host-parasitoid interactions are extremely diverse and complex, yet the evolutionary dynamics are still poorly understood. A category of serpin genes, named CvT-serpins, was discovered to be specifically expressed and secreted by the teratocytes of Cotesia vestalis, an endoparasitoid of the diamondback moth Plutella xylostella. Genomic and phylogenetic analysis indicated that the C. vestalis serpin genes are duplicated and most of them are clustered into 1 monophyletic clade. Intense positive selection was detected at the residues around the P1–P1′ cleavage sites of the Cv-serpin reactive center loop domain. Functional analyses revealed that, in addition to the conserved function of melanization inhibition (CvT-serpins 1, 16, 18, and 21), CvT-serpins exhibited novel functions, i.e. bacteriostasis (CvT-serpins 3 and 5) and nutrient metabolism regulation (CvT-serpins 8 and 10). When the host-parasitoid system is challenged with foreign bacteria, CvT-serpins act as an immune regulator to reprogram the host immune system through sustained inhibition of host melanization while simultaneously functioning as immune effectors to compensate for this suppression. In addition, we provided evidence that CvT-serpin8 and 10 participate in the regulation of host trehalose and lipid levels by affecting genes involved in these metabolic pathways. These findings illustrate an exquisite tactic by which parasitoids win out in the parasite–host evolutionary arms race by manipulating host immune and nutrition homeostasis via adaptive gene evolution and neofunctionalization.