عَنْ جَابِرِ بْنِ عَبْدِ اللَّهِ رَضِيَ اللَّهُ عَنْهُ قَالَ: كَانَ رَسُولُ اللَّهِ صَلَّى اللَّهُ عَلَيْهِ وَآلِهِ وَسَلَّمَ يُعَلِّمُنَا الِاسْتِخَارَةَ كَمَا يُعَلِّمُنَا السُّورَةَ مِنَ الْقُرْآنِ يَقُولُ: ((إِذَا هَمَّ أَحَدُكُمْ بِالْأَمْرِ فَلْيَرْكَعْ رَكْعَتَيْنِ مِنْ غَيْرِ الْفَرِيضَةِ ثُمَّ لِيَقُلْ: اللَّهُمَّ إِنِّي أَسْتَخِيرُكَ بِعِلْمِكَ وَأَسْتَقْدِرُكَ بِقُدْرَتِكَ وَأَسْأَلُكَ مِنْ فَضْلِكَ الْعَظِيمِ فَإِنَّكَ تَقْدِرُ وَلَا أَقْدِرُ وَتَعْلَمُ وَلَا أَعْلَمُ وَأَنْتَ عَلَّامُ الْغُيُوبِ اللَّهُمَّ فَإِنْ كُنْتَ تَعْلَمُ هَٰذَا الْأَمْرَ خَيْرًا لِي فِي دِينِي وَمَعَاشِي قَالَ أَبُو سَعِيدٍ وَمَعِيشَتِي وَعَاقِبَةِ أَمْرِي فَاقْدُرْهُ لِي وَيَسِّرْهُ ثُمَّ بَارِكْ لِي فِيهِ، اللَّهُمَّ وَإِنْ كُنْتَ تَعْلَمُهُ شَرًّا لِي فِي دِينِي وَمَعَاشِي وَعَاقِبَةِ أَمْرِي فَاصْرِفْنِي عَنْهُ وَاصْرِفْهُ عَنِّي وَاقْدُرْ لِيَ الْخَيْرَ حَيْثُ كَانَ ثُمَّ رَضِّنِي بِهِ))
It is narrated from Sayyiduna Jabir bin Abdullah (may Allah be pleased with him) that he said: The Messenger of Allah (peace and blessings be upon him) used to teach us Istikhara (the prayer for seeking guidance) with the same care as he would teach a surah from the Qur’an, and he would say: When any one of you intends to do something, he should pray two rak‘ahs (units) of prayer other than the obligatory ones, then he should say this supplication: O Allah! I seek goodness from You by Your knowledge, and I seek power from You by Your power, and I ask You from Your great bounty. For surely You have power and I have no power, and You know and I do not know, and You are the Knower of the unseen. O Allah! If You know that this matter is better for me in my religion, my worldly life, my livelihood, and the outcome of my affairs, then ordain it for me, make it easy for me, and bless it for me. O Allah! If You know that this matter is bad for me in my religion, my worldly life, and the outcome of my affairs, then turn it away from me and turn me away from it, and ordain for me what is good wherever it may be, and then make me content with it.