Many Social Interactions display either or both of the following well documented phenomena. People tend to interact with similar others (homophily). And they tend to treat others more favorably if they are perceived to share the same identity (in-group bias). While both phenomena involve some degree of discrimination towards others, a systematic study of their relations and interplay is yet missing. In this paper we report thendings of an experiment designed to address this issue. Participants are exogenously and randomly assigned to one of two groups. Subsequently they play a sequence of eight games with either an in-group or an out-group member. Wend strong evidence of in-group bias when agents are matched exogenously. When agents can a ect who they are matched with, we nd strong evidence of homophily. However, in-group biases either decrease or disappear altogether under en-dogenous matching. Self selection of homophilous agents into in-group matches alone cannot explain this fact. We also show that homophily is strongly correlated with risk aversion, and we use this fact to provide an explanation for both the existence of homophily and the disappearance of in-group biases under endogenous matching.