"O my sweet Jesus, in addition to the many graces which Thou hast conferred on me in the course of my life, I ask Thee for this further one: when my soul shall have departed from this world, not only that it not be condemned to Hell, but that it shall not be compelled to remain away from Thee for even a moment in Purgatory. It is true that I am a debtor to Divine Justice, but I hope to pay all my debts from the infinite merits of Thy Passion and Death. O Heaven, holy city of my God, my dear native land! Oh, howI sigh for thee! O happy day when I shall reach thee! O Heavn, my dear Heaven, come quicky and satisfy the desires of a wretched heart that sighs for thee!
"My God, I accept whatever kind of death it may please Thee to send me, with all the terrors, all the pains, all the sufferings that shall justly accompany it. Finally, I pray Thee to accept the destruction of my body as the last act of homage that I can offer to Thy Supreme Divine Majesty, in satisfaction for the offenses committed in the course of my life.
"O Mary, I ask thee for one more grace: Obtain from thy Divine Son that I may die, but that I may die with thee, and that I may fly to Heaven along with thee. O merciful Mother, grant that when my soul is liberated from this wretched body I may go immediately to find thee in Heaven, there to commence that life which will be my occupation for all eternity.
"Requiem aeternam dona mihi, Domine, et lux perpetua luceat mihi. Requiescam in pace."
~Prayer of St. Joseph Cafasso: From The Life of St. Joseph Cafasso by St. John Bosco ~
He made his preparation for death on the first Sunday of the month and devoted the whole day to it. He made his Confession as if it were to be his last, received Holy Communion at Mass as Viaticum, and received Extreme Unction in spirit as if he were a dying man. He recited the prayers for the dying and kissed the Crucifix as if it were the moment of expiring, and then imagined that Our Lady obtained for him another month to prepare for death.
His last illness began on the 9th June as he was hearing Confessions. He was obliged to go to bed and, on the third day of his illness, finding that he had still a little strength left, he got up and spent a few hours in the Confessional until he became quite exhausted. He had great devotion to Our Blessed Lady and it was his constant prayer that he should die on a day dedicated by the Church to her. His prayer was granted, for he died on a Saturday, a day consecrated by the Church to Our Lady. It was a Saturday within the Octave of the Feast of Mary Consolatrix, and was on the vigil of St. John, who is the principal patron of pious works of mercy for those condemned to death, to whose benefit he had devoted so much care. St. John Bosco believes that Our Lady appeared to him at the moment of death and conducted him to Heaven. (Source)