The fascinating diversity of social behavior displayed by animals has long attracted the attention of researchers from different disciplines. Despite the common interest in the topic, some disciplines have focused more on the ultimate (functional) explanations for social interactions while others have mainly focused on the proximate (mechanistic) explanations for these behaviors. However, in order to understand how natural selection shapes the mechanisms underlying social behavior, it is necessary to use an integrative approach examining both mechanistic and functional explanations for behavior. The aim of my Ph.D. project was to understand the proximate and ultimate causes of social behavior variation in the Caribbean cleaning goby Elacatinus prochilos. First, I used an integrative approach that combined ecological, behavioral, cognitive and brain morphology data in order to unveil the potential mechanisms underlying the behavioral phenotypic variation observed in the system. Second, I used a within and between species comparative approach for investigating how brain measurements vary across closely related species with different habitat-feeding phenotypes. Individuals in the species Elacatinus prochilos may adopt two habitat-feeding phenotypes: cleaning or sponge-dwelling. Cleaning gobies, in general, are flexible in their habitat use and obtain most of their food by eating ectoparasites off other reef fish species. In contrast, sponge-dwelling gobies live in groups of up to 70 individuals and do express a clear size-based hierarchy. In the general introduction, I provide some background data that revealed the differences in habitat use, social behavior and group structure between the two phenotypes. In the first chapter, I exposed individuals from both phenotypes to standardized group conditions in the laboratory and asked whether the differences in their natural social and ecological environment impose constraints on adult behavioral flexibility. In the second chapter, I tested whether the habitat-feeding phenotype differences predicted learning performance in two discriminatory two-choice tasks that differed with respect to the relevant cues available to identify the correct choice. In the third and final chapter, I compared the brain structure of the two E. prochilos phenotypes to that of two other species in the genera that also differ in the habitat-feeding mode: the obligatory cleaner Elacatinus evelynae and the obligatory sponge-dwelling Elacatinus chancei. Surprisingly, I did not find any strong evidence that the differences between E. prochilos phenotypes are related to differences in habitat preference, social decision rules, associative learning skills, and brain structure. This means that at this moment, I cannot answer the question of how the differences between phenotypes work. Since I could not find differences in the mechanisms, or in brain structure, it is also currently impossible to answer what differentiation in mechanisms drove the evolution of a sponge-dwelling clade versus a coral-dwelling cleaning clade. However, I found differences in brain areas related to the visual/lateral line sensory axis between the obligatory cleaning versus the obligatory sponge-dwelling species, which revealed independent changes in functionally correlated brain areas that might be ecologically adaptive. In conclusion, the results of my study provide a challenge for various concepts that link individual experience to constraints in behavioral flexibility. Understanding why the gobies are an apparent exception will be the major challenge for future research.