This movie is the predecessor of No Strings Attached and Friends with Benefits. I remember that the two best friends are medical students and one day they decide to sleep together without the emotional attachments. Also, they are a part of this group of friends who at one time or another sleep with each other but these two have secret feelings for each other. At the end, I remember the girl tells her friends that the boy broke up with his girlfriend right before prom to take her (his best friend) to prom. Apparently, her boyfriend had dumped her.
Is it Friends (With Benefits)? I'm not talking about the Mila Kunis & JT one, there was an earlier one in 2009. Plot line on IMDB seems to match up with your description: