Resource competition among conspecifics is central to social evolution and organisation, as it serves as one of the primary selective pressures of group living. This is because the degree of competition for resources impacts the costs and benefits of social interactions. Despite this, how heterogeneity in resource competition drives variation in the type and quantity of long-term social relationships individuals foster has been overlooked. By measuring male mating competition and female foraging competition in a highly social, long-lived mammal, the bottlenose dolphin, we demonstrate that individual variation in long-term intrasexual social behaviour is driven by preferred habitat and experienced resource competition, and this effect differs based on the sex of the individual. Specifically, greater resource competition resulted in fewer social preferences, but the magnitude of the effect varied by both habitat and sex, whereas for social avoidances, both the directionality and magnitude of the effect of resource competition varied by habitat and sex. Together our work shows how fine-scale variation in individual socioecological niches (i.e., unique physical and social environments) can drive extensive variation in individual social behavior (here long-term relationships) within a population, thereby broadening current theories of social evolution and having potential long-term impacts on population social structure.