Eusocial societies present a Darwinian paradox, yet they have evolved independently in insects, mole-rats and symbiotic shrimp. Historically, eusociality has been thought to arise as a response to ecological challenges, mediated by kin selection, but the role of kin selection has recently been questioned. Here we use phylogenetically independent contrasts to test the association of eusociality with ecological performance and genetic structure (via life history) among 20 species of sponge-dwelling shrimp (Synalpheus) in Belize. Consistent with hypotheses that cooperative groups enjoy an advantage in challenging habitats, we show that eusocial species are more abundant, occupy more sponges and have broader host ranges than nonsocial sister species, and that these patterns are robust to correction for the generally smaller body sizes of eusocial species. In contrast, body size explains less or no variation after accounting for sociality. Despite strong ecological pressures on most sponge-dwellers, however, eusociality arose only in species with non-dispersing larvae, which form family groups subject to kin selection. Thus, superior ability to hold valuable resources may favour eusociality in shrimp but close genetic relatedness is nevertheless key to its origin, as in other eusocial animals.