Transmetropolitan is set in a crapsack future that's not too different from our world, just more futuristic and more screwed up. When Gary Callahan becomes President of the USA, he starts to turn it into an authoritarian state. Over the course of trying to bring him down, Spider Jerusalem, the main character, starts to suffer from a seemingly incurable brain condition. In the end, however, he manages to take down Callahan, survives and ends up being among the one percent that doesn't suffer from major long-term effects of his condition, but lets everyone else believe that his brain is a mess so he can live in peace. The world is still a mess, but not really worse than it was at the beginning of the series.
Preacher is this trope. Even more surprising since Garth Ennis is the writer, and the man is best known for writing gritty, bloody stories. Jesse is resurrected after being shot by Starr's men, he reunites with Tulip and they ride off into the sunset. Cassidy is also resurrected, cured of his vampirism and decides to finally mature and become a better person, all the while cherishing his friendship with Jesse and Tulip. Arseface find himself a woman who doesn't see his deformed face (seeing him as a conventionally handsome young man) and The Saint of Killers finally gets to rest in peace. On God's throne.
Marvel 2099: Manifest Destiny ends the 2099 line in this way. After several series of escalating catastrophes, culminating in a mass flood wiping out almost all of humanity, a re-frozen Captain America is discovered. He finally fills everyone in on the cycle of events that turned the 2099 universe into such a Crapsack World, and Miguel is able to steer what's left away from total annihilation. By the year 3099, war has ceased, humanity has accepted mutants and superhumans as their successors, and Earth has become one of the dominant forces in the universe.
During Mark Waid's run on Fantastic Four, the eponymous group ends up in Heaven. Then they meet God—who happens to look like Jack Kirby. He gives Johnny a sketch of the foursome—something to remember the trip by—and tells them 'you'll earn it'. The sketch? The Fantastic Four: merely older, happy as ever, close as ever, and a caption that reads "To Be Continued!"
Except for you, Spider-Man. Though, one might say that by the end of Spider-Island, ol' Spidey prolly earned his happy ending. Except at the end of Spider-Island, he loses his latest girlfriend...though considering most of the fandom never liked her to begin with, one might say he earned a different kind of reward being freed from her. He also got Mary Jane to admit she still loved him, although he wasn't privy to her declaration of love.
And then, of course, it gets blasted when Doctor Octopus occupies his body and pretty much kills him. Then, he comes back and fixes a lot of the crap Doc Ock did to him.
Spider-Man pays a heavy price earning his happy ending in the Marvel Comics 2 Universe's version of his mythology, which follows a lot of his late 90s continuiity. After apparently losing his baby at the hands of Norman Osborn, Peter is left to deal with Osborn's resurfacing as a legit buisnessman and a huge bounty placed on his head as he is framed for the gajillionth time. He's stalked by a mysterious new Green Goblin, the original Hobgoblin, and yet another son of the then-deceased Kraven The Hunter, before he finally clears his name. In the 616 continuity, he defeats Norman Osborn and is reunited with his elderly Aunt May and goes on to live in luxury with Mary Jane, having retired as Spider-Man... until the pull of the ol' "power and responsibility" kick gets the better of him again. In the MC 2 Universe, Peter is reunited with his infant daughter, but opts to remain Spidey anyway. Things go well for him and MJ before a fateful final battle with Norman Osborn costs Peter one of his legs... ouch. Peter decides that THIS is as big a wake-up call as ever to grow up and he puts his web-swinging behind him to raise his daughter... and then his daughter grows up, realizes she has powers, and sets about continuing where her father left off. Peter just can't catch a break trying to earn some peace and quiet... but that's why we love 'em.
Top 10: Beyond The Farthest Precinct. The villain becomes a caring a benevolent God despite his seeming death, and everyone is happy. May seem contrived but good damn did they earn that happy ending.
Neil Gaiman's Batman epilogue "Whatever Happened to The Caped Crusader?" (Batman #686; Detective Comics # 853). Batman eventually realizes that he's having a near-death experience at the end of his life, and comes to accept that even though any telling of the story of Batman has to inevitably end with his death, what defines him is that he will have never given up or stopped fighting to protect Gotham City or to save even one life, and that having the opportunity to do that as Batman has been its own reward.
Kingdom Come. After going to hell and back, Superman, Batman and Wonder Woman (despite having major differences) manage to get along, save the day and restore the world population's faith in the heroes by basically acting like heroes, leading to a CMoH in the epilogue shared by Superman, Wonder Woman and Batman.
This is the biggest problem with the Utopia Initiative in Squadron Supreme. They do come up with solutions to crime, poverty, war and even a stop gap measure for death, but the solutions are generated, implemented and maintained by a small team of superheroes and relies on them to maintain it. Humanity didn't earn it's happy ending the way Zarda's Utopians must have.
Wallace from the Sin City story Hell And Back, went through an entire army of assassins and even saw an old friend die in order to be reunited with his girlfriend Esther. Not only did he earn his happy ending, but considering the typical ending to Sin City stories, someone had to earn a happy one sometime.
Scott Pilgrim and Ramona Flowers: Both are forced to face their pasts and learn from their mistakes in order to have a working relationship.
Whatever Happened to The Man of Tomorrow?: As the Grand Finale to Silver Age Superman, this counts. He defeats all of his famous villains, Loses four of his closest friends, breaks his oath not to kill and loses his power in penance for the act. However because he beat all the villains, he can FINALLY retire in peace.
Luther Arkwright: When Luther appears in Heart of Empire, he has retreated to a war-ravaged world where he serves as a pacifistic healer and diplomat. Victoria herself chooses to abdicate and turn over power to a democratic government, leaving Albion to explore the world and "to end animosity, to make amends, to facilitate recovery".
The The Trial Of The Flash storyline ran for over two years and had the Flash's life being completely wrecked several times, but in the end Barry and Iris are married happily together in the future.
Deconstructed in the first arc of "Artifacts" in the Top Cow universe. Jackie Estacado manages to create a perfect life for himself when he destroys the universe and recreates it In Their Own Image, with Hope alive remaining as his daughter, but Jenny Romano as his wife and Hope's mother, rather than her original mother, Sara Pezzini. With the fact that Jackie perverted the universe to make himself have a happy ending, ruining lives in the process, the wielders of several of the other Artifacts, namely the Magdalena, Tom Judge, and Finch (the new wielder of the Angelus) go out to try to punish him, and Sara herself enters anAngst Coma as a result of learning that her daughter was stolen away from her.
Jackie stole a child from her mother. He perverted the universe's designs for his own needs.