Some excellent ones already mentioned in the thread. Some that haven't been mentioned:

Kingdom Hearts 358/2 DaysYou probably saw the title and went "really, one of the worst KH games?", but Xion's death was pretty damn sad. She sacrifices herself, letting herself be killed by the closest friend she has (arguably potential romantic interest), after which all memory of her is erased.

Final Fantasy XIV HeavenswardAn impressive feat for an MMORPG to be on a list like this if you ask me. The victim in this case: Haurchefant, who was there for you and your two remaining friends at your lowest point. Dies blocking an attack aimed at you.

The Legend of Heroes: Trails of Cold Steel 2Crow. In the first game, he becomes part of your class and your friend. At the end, it's revealed he's a rebel who wants to kill the chancellor (who quite frankly deserves it) and betrays you, killing aforementioned chancellor. He remains your friend though, and although he's on the opposing side in the second game, he continues to go easy on you and giving you hints to grow stronger. In the end you team up with him to stop an apocalyptic robot, but he dies doing so. Bonus points: right after that, the chancellor appears, revealing he's actually still alive. At this point even the protagonist goes "Why'd HE have to die and you're still alive?"

Maybe I'll think of more at some point later