When functional traits are evolutionarily conserved, phylogenetic relatedness can serve as a proxy for ecological similarity to examine whether functional differences among species mediate community assembly. Using phylogenetic- and trait-based analyses, we demonstrate that sponge-dwelling shrimp (Synalpheus) assemblages are structured by size-based habitat filtering, interacting with competitive exclusion mediated by social system. Most shrimp communities were more closely related and/or more similar in size than randomized communities, consistent with habitat filtering facilitated by phylogenetically conserved body size. Those sponges with greater space heterogeneity hosted shrimp communities with greater size diversity, corroborating the importance of size in niche use. However, communities containing eusocial shrimp – which cooperatively defend territories – were less phylogenetically related and less similar in size, suggesting that eusociality enhances competitive ability and drives competitive exclusion. Our analyses demonstrate that community assembly in this diverse system occurs via traits mediating niche use and differential competitive ability.