Anti-immigration rhetoric in the mass media has intensified over the last two decades, potentially decreasing prosocial behavior and increasing outgroup hostility toward immigrants, and fostering ingroup favoritism toward natives. We aim to understand the effects of negative and positive discourses about immigration on prosociality at different levels of societal ethnic diversity. In two studies (student sample, nationally representative sample), we conduct a survey and a 3X3 between-subject experiment, including money-incentivized behavioral games measuring prosociality. We manipulate media representations of immigrants and the probability of interacting with immigrants (the latter measuring diversity). Results show that negative news affects prosociality as a function of the probability of interacting with immigrants. Negative portrayals increase altruism and trustworthiness in ethnically homogenous settings relative to unknown and ethnically-mixed contexts. These results are stronger for right-wing and high-prejudice respondents. Moreover, negative media portrayals of immigrants increase the testosterone-cortisol ratio, which is a proxy for proneness to social aggression. Negative news also increases outgroup-related perceived health risk, outgroup anxiety and outgroup threat less in ethnically-homogeneous contexts. Overall, negative portrayals of immigrants generate physiological and emotional hostility toward the outgroup, and ingroup favoritism in economic transactions, possibly determining efficiency losses in ethnically-diverse markets, relative to ethnically-homogeneous markets.