Defenses conferred by microbial symbionts play a vital role in the health and fitness of their animal hosts. An important outstanding question in the study of defensive symbiosis is what determines long term stability and effectiveness against diverse natural enemies. In this study, we combine genome and transcriptome sequencing, symbiont transfection and parasite protection experiments, and toxin activity assays to examine the evolution of the defensive symbiosis between Drosophila flies and their vertically transmitted Spiroplasma bacterial symbionts, focusing in particular on ribosome-inactivating proteins (RIPs), symbiont-encoded toxins that have been implicated in protection against both parasitic wasps and nematodes. Although many strains of Spiroplasma, including the male-killing symbiont (sMel) of Drosophila melanogaster, protect against parasitic wasps, only the strain (sNeo) that infects the mycophagous fly Drosophila neotestacea appears to protect against parasitic nematodes. We find that RIP repertoire is a major differentiating factor between strains that do and do not offer nematode protection, and that sMel RIPs do not show activity against nematode ribosomes in vivo. We also discovered a strain of Spiroplasma infecting a mycophagous phorid fly, Megaselia nigra. Although both the host and its Spiroplasma are distantly related to D. neotestacea and its symbiont, genome sequencing revealed that the M. nigra symbiont encodes abundant and diverse RIPs, including plasmid-encoded toxins that are closely related to the RIPs in sNeo. Our results suggest that distantly related Spiroplasma RIP toxins may perform specialized functions with regard to parasite specificity and suggest an important role for horizontal gene transfer in the emergence of novel defensive phenotypes.