1. Enter the afterlife, heaven, utopia - this is the ideal solution. But requires faith. And it might not happen.
2. Next best - make sure you survive and live to see the technological singularity, when humans could become immortal (or even extinct in a worst case scenario). We're talking mind uploading here. You need to follow the 3 bridges of radical life extension here - eat healthily, take special drugs (hardcore pill-popping) to eventually exploit the coming nanotech revolution - future medical devices floating in the blood stream etc.
3. Get frozen for the future and brought back from the dead. If you don't live there already you will be transported to the United States when you die to be kept in cold storage. This is still a huge gamble because cryogenics is still medically unproven and it could take around a century before it is discovered if the process is successful.
4. Die and return your body to the earth, but be digitally resurrected like Audrey Hepburn was recently for a chocolate bar ad. OK - you're dead, but to other people you're still kind of there, even spectacularly. And in the perhaps the not so distant future an artificial AI based on memories and materials supplied by your relatives could be linked to your digital resurrection, or physical robotic body. But you're still only a crude copy, and it's not really you.
5. Wait perhaps even billions of years (not so painful, because you're actually dead, right?) for our distant post-human descendants to unite with the universe and create an everlasting cosmic computer. In pseudo science this is known as 'The Omega Point'. This will bring every man, woman and child that has ever lived back into existence. If this works, it could conflict with some of the previous solutions.