In communication networks, territorial neighbours often regulate social relations using long-range signals. However, such relations may be affected when unfamiliar third parties threaten the territorial integrity of the neighbourhood. We investigated responses of vocally interacting nightingales, Luscinia megarhynchos, that were successively challenged by simulated rivals prospecting the neighbourhood. Using playback experiments, we tested whether territorial behaviour of males is affected differently dependent on whether their neighbours were challenged with aggressively or moderately singing rivals and whether information from the observed interaction is being used in subsequent encounters with the simulated prospector. Males sang more moderately the closer they were to a neighbour that was threatened by an aggressively singing rival. When challenged themselves, these males then discriminated between rivals depending on how they had previously interacted with their neighbour. Thus, males condition their vocal behaviour on their neighbour’s situation and use information from neighbour-stranger interactions in future decision making. These findings reveal that in social networks, rivals’ behaviour and distance to neighbours matter, emphasizing the importance of considering multiple individuals and their spatial relations when assessing the functions of territorial signalling.