More than any other species, humans form social ties to individuals who are neither kin nor mates, and these ties tend to be with similar people. Here, we show that this similarity extends to genotypes. Across the whole genome, friends' genotypes at the single nucleotide polymorphism level tend to be positively correlated (homophilic). In fact, the increase in similarity relative to strangers is at the level of fourth cousins. However, certain genotypes are also negatively correlated (heterophilic) in friends. And the degree of correlation in genotypes can be used to create a "friendship score" that predicts the existence of friendship ties in a hold-out sample. A focused gene-set analysis indicates that some of the overall correlation in genotypes can be explained by specific systems; for example, an olfactory gene set is homophilic and an immune system gene set is heterophilic, suggesting that these systems may play a role in the formation or maintenance of friendship ties. Friends may be a kind of "functional kin." Finally, homophilic genotypes exhibit significantly higher measures of positive selection, suggesting that, on average, they may yield a synergistic fitness advantage that has been helping to drive recent human evolution.