Social interactions are not all or nothing. In some moments we are highly competitive, in others we are very cooperative, but sometimes we are somewhere in between and we constantly adjust our social orientation over time. Such a continuous spectrum of social approaches depends on both the actions favoured by the social environment and those of conspecifics. However, research examining strategic social interactions typically uses binary choices and therefore cannot consider how people shift their behaviour along a cooperation-competition continuum. Here, we use a novel economic game – the Space Dilemma – in which two players make a choice of a spatial location to indicate their degree of cooperativeness on each trial. Participants played the game across different social environments allowing us to compare their behaviour and neural responses in cooperative and competitive contexts. Using computational modelling and fMRI we show that social environments, social biases and inferences about others’ intentions shape people’s decisions about their degree of cooperativeness, in a manner consistent with a Bayesian learning model. We show that sub-regions of the brain previously linked to social cognition, including the Temporo-Parietal Junction (TPJ), dorso-medial prefrontal cortex (dmPFC) and the anterior cingulate gyrus (ACCg), signalled features of the Bayesian model. This included context independent surprise signals in the TPJ, context dependent signals in ACCg and dmPFC when monitoring others’ changes in competitiveness, as well as signals guiding shifts along the cooperation-competition continuum in posterior dMPFC. These results highlight how the social environment, one’s own and others’ social preferences all contribute to guide the continuous trade-off between cooperation and competition.