I'm not so sure that religious beliefs -- everlasting hellfire, for one -- are all that comforting. If anything, I find the idea of an omnipotent and omniscient God far more unsettling than meaninglessness.
If you're one of the downtrodden, the belief in heaven and hell exists can be a great comfort. You're a good person (even though you suffer now) and will go to heaven while your oppressors (who now lead the good life) will go to hell.