Aggregation can confer advantages in animal foraging, defense, and thermoregulation. There is a tight connection between the evolution of insect sociality and a highly effective immune system, presumably to inhibit rapid disease spread in a crowded environment. This connection is less evident for animals that spend only part of their life cycle in a social environment, such as noneusocial gregarious insects. Our aim was to elucidate the effects of group living by the gregarious larvae of the Glanville fritillary butterfly with respect to individual performance, immunity, and susceptibility to a parasitoid. We were also interested in the role of family relative to common postdiapause environment in shaping life-history traits. Larvae were reared at high or low density and then exposed to the pupal parasitoid wasp Pteromalus apum, either in presence or absence of a previous immune challenge that was used to measure the encapsulation immune response. Surviving adult butterflies were further tested for immunity. The wasp offspring from successfully parasitized butterfly pupae were counted and their brood sex ratios assessed. Larvae reared at high density grew larger and faster than those at low density. Despite high mortality due to parasitism, survival was greater among individuals with high pupal immunity in both density treatments. Moreover, butterfly pupae reared at high density were able to kill a larger fraction of individuals in the parasitoid broods, although this did not increase survival of the host. Finally, a larger proportion of variation observed in most of the traits was explained by butterfly family than by common postdiapause rearing environment, except for adult survival and immunity, for which this pattern was reversed. This gregarious butterfly clearly benefits from high conspecific density in terms of developmental performance and its ability to fight a parasitoid. These positive effects may be driven by cooperative interactions during feeding.