I personally strongly believe that each one of us, regardless of faith or lack of it, on the brink of death, through the grace of God's abundant mercy, has personal revelation and is given the last chance to accept Jesus .
Now, you would say , well, seeing He is for real everyone would surely accept Him. The sad truth is that by the time of death some people's hearts have become so corrupted they can no longer stand the love, the light, the goodness that they are presented with on meeting the Lord . They are unable to choose salvation.
In contrast, anyone who in their lifetime sought the light, longed for the good, would be drawn to Jesus as their hearts will recognize he is what they always looked for, and they will accept salvation.
Of course, following chistian ways and those of other faiths that are of same principle ( love thy neighbour, do not kill, steal etc ) do help to ensure that your heart does not corrupt.And seeking and believing in God's forgiveness as we fail, stops us from starting to hate ourselves which can corrupt as well.
I believe other people's prayers, sacrifices and sufferings do help a soul at death door to accept Jesus.
I also believe in the concept of purgatory as the place ( or state of consciousness ) where you atone for the sins you didn't atone for in this lifetime and you learn to love God.
And yes , HE is the only way.