Imam Ja‘far as-Sadiq said that Archangel Gabriel descended to Yusuf when he was in the prison. He told him that the Almighty sends His salaams and says that “I have made you the best of my creations.” Yusuf fell down and putting his cheek on the ground said, “You Alone are my Lord.” Archangel Gabriel told him, “The Almighty says that He has made you more lovable to your father than your other brothers.” Yusuf touched his cheeks to the ground and said to Allah. “You Alone are my Lord!” Archangel Gabriel said, “The Almighty says that He brought you out of the well you had been pushed in it and were convinced that you would perish.” Again Yusuf touched his cheek on the earth and said, “You Alone are my Lord.” Archangel Gabriel said, “Indeed the Almighty had decreed this punishment for you because you sought the help of someone else. So you remain in prison for some more years.” When the prescribed term was over, and he was permitted to recite the Dua al-Faraj (Supplication of release) he kept his cheeks on the ground and said, “Allahumma inkaanat d’unoobi qad Akhlaqat wajhi in’ndaka fainni atawajjahoo ilaika be wahje aabaais’ s’aalehe’en – Ibrahim, wa Ishaq wa Ya’qoob.” (Translation: O Allah if my sins have degraded my face near You, I certainly turn towards You through the faces of my ancestors, Ibrahim, Ishaq and Ya‘qub).
The Almighty forgave him and he was released from the prison. The narrator asked Imam if they could also recite the same supplication. Imam told him to recite as follows:
“Allahumma inkaanat d’u noobi qad Akhlaqat wajhi in’ndaka fainni atawajjahoo ilaika be nabiyyeka nabiyyar rah’ma. S’allallaaho a’laihe wa aalehi wa Aliyy-waa Faat’emah – wal h’asane-wal-h’osaine wal aaimmah a’laihimus salaam.”