The quote that your question comes from is at the very end of chapter 22. Pi is speaking of hypotheticals; he is imagining two different types of people dying on a deathbed. The first is an atheist. Pi, a very religious child, imagines an atheist finally being converted as he faces the finality of death; he imagines that atheist proclaiming, "White, white! L-L-Love! My God!" and then taking a "deathbed leap of faith" as they finally believe that God exists. Then, Pi mentions that if an agnostic stays true to his beliefs, even on a deathbed, that he might cry out, "Possibly a f-f-failing of oxygenation of the b-b-brain" to explain what is facing him, which is death. He says that that response, that piddly explanation for death, that your brain simply loses oxygen (which is technically true), is very boring and lacking in imagination. That kind of death, Pi says, makes you "miss the better story." And that is your answer right there. Dying alone with no faith or religion or imagination is you missing out on the better story. It is a much better story to imagine yourself floating up to God and living amongst angels in celestial glory, or being reborn as a more glorious creature, or being absorbed into the great universe to become part of the voice of existence. Pi ties a good afterlife to imagination, and to religion, saying that the two combine to make what comes after death a much better story.