Whenever the Messenger of Allah ﷺ bid farewell to a man, he would take him by the hand and not let go until the man himself released the hand of the Prophet ﷺ. He would say, "I entrust to Allah your religion, your trust, and the final outcome of your deeds."
كان رسول الله ﷺ إذا ودع رجلا أخذ بيده فلا يدعها حتى يكون الرجل هو يدع يد النبي ﷺ ويقول: أستودع الله دينك، وأمانتك، وآخر عملك.
Narrated by Tirmidhi (3442, 3443), Abu Dawud (2600), and Ibn Majah (2826), and graded sahih by Ibn Khuzayma (2531), Ibn Hibban (2693), and Hakim (1/442), all of them through routes going back to Ibn Umar, except that some of the routes contain criticism, but they strengthen one another, and some of the narrators confined themselves to the farewell supplication only.