In A History Of Magic Sadako Sasaki (the girl who died from leukemia as a result of the Hiroshima bombing, and the inspiration of the Thousand Origami Cranes trope) chose this when she used her wish to wish that the atomic bomb never was used again, rather than wish herself cured of leukemia. She thinks it a worthwhile sacrifice, bringing a rare moment of remorse from Kyubey.
In the post-Madoka world, where the masquerade is broken and there's prejudice on both sides, the Puella Magi and the humans are on the verge of war, aggravated by humans sending brainwashed Puella Magi to kill the Magi in positions of power. Billy Kane, the man that technically broke the masquerade (long story why), decided to take the blame for the brainwashed magi assassins in an attempt to stop the war from happening. It somewhat works, though a huge Demon outbreak helped,.
At the very end of the fic, humanity and magi are almost completely wiped out. Kyubey tells Homura that the Incubators plan on taking the last human, cloning it, and using that to create a new stock of humans to make Puella Magi from, and they were willing to wait until Homura died from her fatal injuries to take the baby unless she killed the baby herself. Homura made a wish and sacrificed her chances of ever seeing Madoka again to ensure this baby made it into Madoka's heaven and they both died. The sacrifice was enough to reunite Homura with Madoka anyway, and bridge the heavens between Puella Magi and humans.
Subverted in The Immortal Game. Twilight Sparkle throws herself into Titan's free will-removing spell in order to disrupt it at the last second, fully expecting to die in the process. Instead, she absorbs the remnants of Harmony's power and is transformed into an alicorn.
There's an example from a villain later on, as when Apple Bloom tries to immobilize Queen!Twilight with a nonfatal sword strike, Trixie pushes her out of the way and is run through instead.
Ultimately subverted with Apple Bloom, who is willing to do the same as Bayonet to defeat Queen!Twilight (and later, the Darkness), but survives.
In Human Curiousity, a number of Nations sacrifice their own chances to escape the HCS facility - leading to their own deaths - in order to secure the freedom of their friends and family. Among them were Scotland and Switzerland (who stayed behind and drew HCS fire so England and Liechtenstein respectively could escape), Denmark (who held back HCS soldiers so Estonia could continue on) and Russia and Belarus (who held off the HCS soldiers that tried to stop England and Liechtenstein from making it outside).
In the Pony POV Series, G1 Mimic pulls a You Shall Not Pass on Discord to let her friends and daughters escape. In the process, she manages to shatter his fang before he kills her in his fury, being the only mortal to ever hurt him permanently.
Subverted comically in Calvin and Hobbes: The Series - Hobbes pulls one of these off while fighting Clock King, and while Calvin dramatically monologues over his body, Hobbes walks in with ice cream, revealing the sacrificed one to be Socrates.