Dance on My Grave by Aidan Chambers (1982) — see its film and TV adaptations.
Hal's summer affair with Barry Goldman ends tragically when Hal discovers he is much more committed to the relationship than his friend.