Staphylococcus aureus forms biofilms on indwelling medical devices using a variety of cell-surface proteins. There is growing evidence that specific homophilic interactions between these proteins represent an important mechanism of cell accumulation during biofilm formation, but the underlying molecular mechanisms are still not well-understood. Here we report the direct measurement of homophilic binding forces by the serine-aspartate repeat protein SdrC and their inhibition by a peptide. Using single-cell and single-molecule force measurements, we find that SdrC is engaged in low-affinity homophilic bonds that promote cell-cell adhesion. Low-affinity intercellular adhesion may play a role in favoring biofilm dynamics. We show that SdrC also mediates strong cellular interactions with hydrophobic surfaces, which are likely to be involved in the initial attachment to biomaterials, the first stage of biofilm formation. Furthermore, we demonstrate that a peptide derived from β-neurexin is a powerful competitive inhibitor capable of efficiently blocking surface attachment, homophilic adhesion, and biofilm accumulation. Molecular modeling suggests that this blocking activity may originate from binding of the peptide to a sequence of SdrC involved in homophilic interactions. Our study opens up avenues for understanding the role of homophilic interactions in staphylococcal adhesion, and for the design of new molecules to prevent biofilm formation during infection.