Once there was an ascetic who struggled his whole life to reach perfection. He distributed all his goods to the poor, withdrew into the desert, and prayed to God night and day. Finally the day came when he died. He ascended to heaven and knocked on the gates. 'Who is there?' came a voice from within. 'It's me!' Answered the ascetic. 'There isn't room for two here,' said the voice. 'Go away!' The ascetic went back down to earth and began his struggle all over again: poverty, fasting, uninterrupted prayer, weeping. His appointed hour came a second time, and he died. Once more he knocked at the gates of heaven. 'Who's there?' came the same voice. 'Me!' 'There isn't room for two here. Go away!'.
The ascetic plummeted down to earth and resumed his struggle to attain salvation even more ferociously than before. When he was an old man, a centenarian, he died and knocked once again on the gates of heaven. 'Who's there?' came the voice. 'Thou, Lord, Thou!' And straightway the gates of heaven opened, and he entered
I think this is from Nikos Kazantzakis, God's Pauper, but I am not sure. When I reread it some day I will find out!