Abu Dawud
Prayer
Book Number: 002 / Hadith Number: 1533
Narated By Jabir b. Abd Allah : The Apostle of Allah (pbuh) used to teach us the supplication for istikhara (seeking what is beneficial from Allah) as he would teach us a Surah (chapter) from the Qur'an. He would tell us: When one of you intends to do a work, he should offer two supererogatory rak'ahs of prayer, and then say (at the end of prayer): "O Allah, I seek what is good from Thee by Thy knowledge, and I seek power from Thee by Thy power, and I ask Thee for Thy vast grace, for Thou hast power, and I have no power, and Thou Knowest and I do not know, and Thou best knowest the unseen. O Allah, if thou knowest that this work (one should name the work one is intending to do) is good for me, for my religion and for my livelihood, for my next world, and for the consequence of this work of mine, then appoint it for me, make easy for me, and give blessing to me in it. O Allah, if Thou knowest that it is evil for me and for all those things mentioned formerly, then turn me away from it, and turn it away from me, and appoint for me what is good, whatever it is, and make me pleased with it." A version goes: "If work is good immediately or subsequently."
Ibn Maslamah and Ibn 'Isa reported from Muhammad b. al-Munkadir on the authority of Jabir.