Legend of Galactic Heroes: Reinhard and Kircheis. How much does this trope play out? Comparable to Gilgamesh & Enkidu or Alexander & Hephaestion.
There's also Reuenthal and Mittermeier, the "twin stars of the Empire." They're very attached to each other, Mittermeier acts as a sort of Living Emotional Crutch to his friend, and Reuenthal once refers to him as the greatest happiness in his life.
Code Geass: They put each other through absolute hell first, but Lelouch and Suzaku's reconciliation at the end implies they've come to an understanding of eachother. Lelouch's sacrifice at the end of the series changes the course of Suzaku's life forever (and, ironically, gives him a reason to keep living)as well as the world.
In Heat Guy J, Clair's Elite Mook and friend Ian is killed after a fact-finding mission gone wrong, and just hours later Mitchal blows himself up (ostensibly to allow Giovanni and Clair to make a getaway from their enemies, though part of it may have been so he and Ian could be Together in Death). All Clair has left of them are Mitchal's "lucky" dice and Ian's Phi Beta Kappa ring. This (coupled with losing his Vampire status and his home, plus the Daddy Issues he had from the start) sends him into an Angst Coma.
In 07-Ghost, Mikage is the only friend that Teito has. Mikage likewise is very attached to Teito and fiercely protective of him. After a few plot events, Ayanami hijacks Mikage's body and irrepairably destroys his soul. Frau is forced to kill him to save Teito's life. It's worse, in that Mikage dies smiling in Teito's arms before dissolving into feathers. It's made better/worse, depending on the viewer, when Mikage's soul is reincarnated into the cutest bunny-dragon you ever did see.
Attack on Titan has Jean and Marco, who become close friends during their three years in training together. Both dream of joining the Military Police Brigade, but for very different reasons and are opposites in terms of demeanor. However, Marco recognizes and encourages Jean's potential as The Leader, seeing in him someone capable of much more than he's willing to believe. During the gruesome cleanup of Trost in the aftermath of the battle there, Jean discovers what remains of Marco. The meaningless and lonely death of his best friend prompts Jean to abandon his selfish ideals, and enlist in the Survey Corps where he quickly establishes himself as a capable young leader. When the others joke wondering what happened to the Jean they all knew, he states his intention to not disappoint those charred bones he saw.
Rebuild of Evangelion: The third installment is a big Trauma Conga Line for Shinji, but what finally breaks him is the death of Kaworu, the only person in the film who was genuinely nice to him.
Their relationship counts in the original anime and its manga adaptation as well. The details differ in each continuity, but all three incarnations involve an intense relationship between the two which ends in Kaworu's death, driving Shinji deeper into despair.
Waver and his Servant Rider from Fate/Zero, despite only knowing each other for a few weeks, forge an intense friendship which culminates in Waver pledging his Undying Loyalty to Rider shortly before the latter is killed by Gilgamesh (whose own tragic bromance with Enkidu is alluded to afterwards). Waver undergoes tremendous Character Development due to his friendship with Rider and is deeply influenced by his Servant's ideals for the rest of his life. Considering Rider is theAlexander the Great, this isn't surprising.
In Mobile Suit Gundam AGE, the series' second protagonist (it's a Generational Saga) Asemu Asuno eventually have to fight his bestfriend Zeheart Galette, who is The Mole of the other faction. Obviously, both guys have a hard time dealing with having to fight each other, especially Asemu. Ultimately, Asemu ended up having to kill Zeheart, but not long before having a final heartfelt conversation. Their friendship is much more emphasized in the show's Special Edition.
Booster Gold and the Blue Beetle, though in some continuities, the new Beetle serves as Replacement Goldfish. Beetle's death makes Booster go from an egotistical, fame-seeking buffoon to wanting to genuinely be a heroic hero who contributes something.
Though He Got Better, Green Lantern Kyle Rayner's death in the Blackest Night story arc caused his close friend and colleague, Guy Gardner, to break down in tears for a moment before entirely giving in to his maddened rage and becoming a Red Lantern.
Brian's Song: Brian Piccolo and Gayle Sayers (yes, he's male).
An epic womance: the two female scientists from Volcano. The remaining scientist (Anne Heche) is that much more determined to convince FEMA that there's really a volcano starting in Los Angeles because her best friend died to prove it.
Similarly, the death of her close friend and fellow CIA agent in the line of duty causes the main character of Zero Dark Thirty to adopt an It's Personal stance on the search for Bin Laden.
Obi-wan Kenobi and Anakin Skywalker share this fate throughout the Star Wars saga.
In Captain America: The First Avenger, this is the fate of James "Bucky" Barnes. This also follows the comics, though in the film Bucky and Steve are the same age, while in the comics Steve is older.
Dead Poets Society has Neil and Todd who are roomates and best friends at 'Hellton'. Throughout the movie they support each other's fight against their controlling parents. Eventually Neil is cowed by his father and committs suicide, leaving Todd openly distraught and heartbroken.
Happens due to KHAAAAAAAAAAAAAN! in Star Trek II to Kirk, who has to watch as Spock dies. Of course, in the next movie Spock gets better, but at the time it was intended to stick.
A variation of this happens in X-Men: First Class, Magneto and Professor X form a close friendship, but ultimately part because of a major difference in ideals. Notably, neither is killed, although Xavier does sustain a permanent injury that leads to Magneto cradling his cripple.
In Top Gun the death of Maverick's co-pilot and volleyball partner Goose is a major turning point in the characters life.
Sam and Dean Winchester manage to do this to one another multiple times. Dean is the ruling champion, but if it weren't for Sam's first major death the whole plot from the beginning of season three onward would not exist in any recognizable form.
Getting him out of it caused Dean to die at the end of season three, which caused Sam to have a major character shift in the four months between then and when Dean got better again at the start of season four; and the combination of what the two of them did while Dean was dead set up the need for Sam to die at the end of season five. Dean followed Sam's "last request" to try and live a normal life, but was pissed when Sam shows up again and reveals he's been back for a while without telling him. Then it turned out Sam's soul was still stuck in Hell...
Dean's 101 deaths during one season three episode hit Sam pretty hard, too, especially the one that last six months before the bastard undid it. And hence the title of reigning champion. Also the fact that he stayed dead the longest.
Dean and Castiel over the course of seasons six and seven. After Cas's power-trip and ensuing "sacrifice", Dean spends half a season going through the motions like season-six-Buffy, unable to really care about himself or the state of the world, and only starting to recover after Castiel reappears.
"You know, I used to be able to just shake this stuff off. You know, whatever it was. It might take me some time, but... I always could. What Cas did... I just can't – I don't know why."
Dean really can't catch a break from this trope. If it isn't Sam, it's Cas. If it isn't Cas, it's Benny.
Although Buffy gets better by the end of Season 6, Buffy and Willow between the season 5 finale and the season 6 premiere of Buffy the Vampire Slayer totally fits this trope. Buffy's death causes Willow to go into a spiral of desperation and bargaining that eventually leads her into extremely morally ambiguous territory in her effort to resurrect her best friend, leads to her sliding into Drunk with Power, and emotionally sets her up for a Despair Event Horizon after her unrelated romantic tragedy one season later.
Horatio and Archie's friendship in the Horatio Hornblower miniseries was extremely deep. They were together in purgatory (Horatio's first ship Justinian where they both got bullied and tormented by a sadistic midshipman), got separated and met again in hell, a Spanish prison when they both got tortured in a Punishment Box and Archie tried to starve himself. Horatio saved Archie's life when he nursed him back into health, and Archie saved Horatio's when he dragged him from an exploding bridge during a doomed mission in France. In "Retribution", Horatio is shattered by Archie's slow and painful death and his Heroic Sacrifice. However, the emotional fallout after Archie's death isn't explored overtly in the subsequent series, but Hornblower is obviously a man who is bitter and surly, without a pal who could make him show his more cheerful and pleasant side. note This was all done quite possibly due to Executive Meddling because Forester's estate wanted Hornblower to be turned back again into "a hero alone" which is who he is in the books. They also insisted that Archie, a Composite Character, is written off, and Hornblower becomes paired with his canonical best pal, Lieutenant Bush, whose friendship is less tight.
Merlin ends with Arthur dying in Merlin's arms and Merlin believing that he's failed in his destiny to protect him. Scant comfort is derived from his very close friendship with Guinevere Arthur's widow and the sole ruler of Camelot and the Great Dragon's promise that one day Arthur will return in the time of Britain's greatest need. A Flash Forward shows Merlin as a hobo in modern times, still waiting for Arthur's return.
This seems to be a thing that happens towards the finale of many a Heisei-era Kamen Rider show between the protagonist and the deuteragonist.
Kamen Rider Ryuki: In the second to last episode, Shinji/Ryuki is dealt a fatal wound by a group of Monsters and his death prompts Ren/Knight to attempt to become the Final Rider.
In the 13 Riders special, the roles are reversed.
Kamen Rider Blade: Kenzaki/Blade sacrifices his humanity to become a Joker Undead in the finale, but as a result, must separate himself from Hajime/Chalice.
In The Movie, the roles are reversed with Hajime sacrificing himself in place of Kenzaki.
Kamen Rider Double: Philip disappears at the conclusion of the second to last episode, leaving Shotaro to protect Futo as Kamen Rider Joker. Fortunately, Philip is revived in the final episode.
Kamen Rider OOO: Ankh's Core Medal is cracked by Maki, but decides to help Eiji/OOO defeat the latter. After defeating Maki, Ankh dies, although his spirit is seen to follow Eiji.
Smash: Kyle is the only person Jimmy seems to genuinely love, but he's a jerk to him too. Then Kyle is killed in a hit-and-run, and Jimmy cleans up his act, dedicates himself to their musical, sobs when Kyle wins a posthumous Tony, and fesses up to a past crime and does time so he can start fresh.
Landon Parke-Laine and Anton Next in the Thursday Next series. Especially tragic because Landon's testimony in the investigation of the events that killed Anton turned Anton's name to mud for all history.
Dragon Lance: Raistlin's ascension to the tower of high sorcery leaves Caramon a drunken wreck for years. Without his brother, he felt completely unneeded. It is only after Raistlin actually dies that he is able to move on with his life.
While Robert is no longer a main character by the third book in The Emigrants suite him and Arvid still fit this trope. Arvid's death on their way to California has a deep impact on Robert and he never recovers.
Also Apollo and Hyacinth, who was an even bigger Pretty Boy than Apollo. Zeus was jealous that someone so beautiful was spending all his time with someone other than him, so he made the discus that Apollo had thrown slam into his head and kill him.
Kristina från Duvemåla: Robert and Arvid. Robert's song about Arvid's death, "Gold Can Turn To Sand", is probably the saddest song in a musical that's filled to the brim with sad songs. Especially poignant in the original Swedish where Robert emphasizes Arvid's death as the exact moment when gold turned to sand.
Female version in Wicked with Elphaba and Glinda. "Who can say if I've been changed for the better/but because I knew you, I have been changed for good."
In Mass EffectGarrus seems to take Shepard's death this way, especially if you influenced him to be more Renegade in the first game. Following the destruction of the Normandy, he heads back to the Citadel, either to rejoin C-Sec or try to become a Spectre. Either way, after seeing the Council bury evidence of the Reapers and discredit everything Shepard did he decides he's finally had enough of the Citadel's bureaucracy and heads to the galaxy's Wretched Hive to try and fight crime at its source. This is especially sad if you take him back to Omega after you've recruited him and he notes that despite everything he did, he never actually make a difference.
In Knights of the Old Republic, Revan and Malak were best friends before their fall the dark-side, leading Malak to eventually betray his oldest friend. When confronted with an amnesiac Revan who has returned to the light-side, he only regrets betraying them from afar and mourns the loss of the "real" Revan.