I would recommend Poul Anderson’s The High Crusade. Medieval Englishmen take on an interstellar empire. There are some humorous bits and an upbeat ending. Anderson wrote some stories that are upbeat and/or pretty funny and some that were tragic. His short story “Day of Burning” gives Chee Lan some funny lines and is pretty good. That story uses FTL travel, but Tau Zero was firmly grounded in the hard science of the early 1970’s and has a great ending.
I recently read Connie Willis’ The Domesday Book, and while parts are grim, it does have an ending as upbeat as can be about the Black Death. Highly recommended.
Fritz Leiber’s novel The Silver Eggheads is hilarious and has a great ending.
Someone mentioned P.J. Farmer’s Riverworld series. Try The Maker of Universes, the first and best of the World of Tiers series.
I agree that Heinlein, Niven, and Asimov were generally upbeat. Pournelle and Niven’s Lucifer’s Hammer has an optimistic ending although much of the world gets destroyed. Someone mentioned Arthur C. Clarke and I would try Childhood’s End and The Sands of Mars.
Also recommended are Zelazy’s Lord of Light, Creatures of Light and Darkness, and “The Doors of his Eyes, the Lamps of his Mouth.”