Any shows where the male lead has had an unrequited love for the female lead for years, but she's dated someone else, maybe his friend. Eventually something happens and he gets his chance. She starts falling for him, but then the ex comes back. She chooses to stay with the male lead though.

Go Ho's Starry Night! The ML was in love with the FL before she even started dating someone else! 

Ho Goo's LOVE : She was his first love . reunite years later, he helps her. 

I wouldn't say the ML and SML are good friends in any of these, but in the first two they can at least be considered allies for part of the drama:

  • Sound of the Desert - the ML falls for the FL pretty much as soon as he meets her, but I can't remember exactly how much time passes before she accepts his feelings; I think it was at least a year though
  • The Imperial Doctress - the FL is loyal to the ML before the end of the drama, but doesn't get to truly be with him until the very end
  • Something in the Rain - it's implied that the ML has liked the FL for a long time and isn't just falling for the FL when he returns to Korea at the beginning of the drama, but as far as I can remember there wasn't anything that 100% confirmed that
  • Go Ho's Starry Night - edit: +1 for Pratyasha's recommendation

Dramas where the ML has unrequited feelings for the FL for years and the FL chooses to be with the ML in the end, but it doesn't quite fit your other criteria:

  • What's Wrong with Secretary Kim - the ML is aware that he wants the FL by his side very early on, but doesn't realize he's in love with her until much later; the FL never dates anyone else
  • Just Between Lovers - the FL is dating someone else when the ML first meets her when they're young, but she's single when they meet again as adults
  • I Hear Your Voice
  • I Need Romance 3
  • In Time With You
  • Empress Ki
  • The King's Woman

One more for Go Ho's Starry Night and The King's Woman. Both of them are some of my all time favorite shows.

One more for Go Ho's Starry Night and The King's Woman. Both of them are some of my all time favorite shows.