The size and structure of social groups of animals can be governed by a range of ecological factors and behavioral interactions. In small, highly site-attached coral reef fishes, group size is often constrained by the size of the habitat patch they are restricted to. However, group size may also be influenced by changes in abundance along important environmental gradients, such as depth or distance offshore. In addition, the body size and sex structure within social groups can be determined by the size of the habitat patch and the dominance relationships among group members. Here we examined the roles of ecological factors and behavioral interactions in governing group size and structure in the orange clownfish, Amphiprion percula, on inshore reefs in Kimbe Bay, Papua New Guinea. We quantified relationships between ecological variables (anemone size, depth, and distance from shore) and social group variables (group size, and total body length of the three largest individuals (ranks 1, 2, and 3)). Anemone size explained the greatest amount of variation in group variables, with strong, positive relationships between anemone surface area and group size, and total length of individuals ranked 1, 2, and 3. Group structure was also weakly correlated with increasing depth and distance from shore, most likely through the indirect effects of these environmental gradients on anemone size. Variation in group size and the lengths of ranks 2 and 3 were all closely related to the length of rank 1. Path analysis indicated that anemone size has a strong direct effect on the length of rank 1. In turn, the length of rank 1 directly affects the size of the subordinate individuals and indirectly affects the group size through its influence on subordinates. Hence, anemone size directly and indirectly controls social group size and structure in this space-limited fish species. It is also likely that anemonefish have feedback effects on anemone size, although this could not be differentiated in the path analysis.