Language:
كتاب الاستسقاء
15  
Invoking Allah for Rain (Istisqaa)
(8)
Chapter: Istisqa' (to invoke Allah for the rain) on the pulpit
(8)
باب الاِسْتِسْقَاءِ عَلَى الْمِنْبَرِ
Sahih al-Bukhari 1015

Narrated Qatada:

Anas I said, "While Allah's Messenger (ﷺ) (p.b.u.h) was delivering the Friday Khutba (sermon) a man came and said, 'O Allah's Messenger (ﷺ)! Rain is scarce; please ask Allah to bless us with rain.' So he invoked Allah for it, and it rained so much that we could hardly reach our homes and it continued raining till the next Friday." Anas further said, "Then the same or some other person stood up and said, 'O Allah's Apostle! Invoke Allah to withhold the rain.' On that, Allah's Messenger (ﷺ) I said, 'O Allah! Round about us and not on us.' " Anas added, "I saw the clouds dispersing right and left and it continued to rain but not over Medina."

حَدَّثَنَا مُسَدَّدٌ، قَالَ حَدَّثَنَا أَبُو عَوَانَةَ، عَنْ قَتَادَةَ، عَنْ أَنَسٍ، قَالَ بَيْنَمَا رَسُولُ اللَّهِ صلى الله عليه وسلم يَخْطُبُ يَوْمَ الْجُمُعَةِ إِذْ جَاءَ رَجُلٌ فَقَالَ يَا رَسُولَ اللَّهِ، قَحَطَ الْمَطَرُ فَادْعُ اللَّهَ أَنْ يَسْقِيَنَا‏.‏ فَدَعَا فَمُطِرْنَا، فَمَا كِدْنَا أَنْ نَصِلَ إِلَى مَنَازِلِنَا فَمَا زِلْنَا نُمْطَرُ إِلَى الْجُمُعَةِ الْمُقْبِلَةِ‏.‏ قَالَ فَقَامَ ذَلِكَ الرَّجُلُ أَوْ غَيْرُهُ فَقَالَ يَا رَسُولَ اللَّهِ ادْعُ اللَّهَ أَنْ يَصْرِفَهُ عَنَّا‏.‏ فَقَالَ رَسُولُ اللَّهِ صلى الله عليه وسلم ‏ "‏ اللَّهُمَّ حَوَالَيْنَا وَلاَ عَلَيْنَا ‏"‏‏.‏ قَالَ فَلَقَدْ رَأَيْتُ السَّحَابَ يَتَقَطَّعُ يَمِينًا وَشِمَالاً يُمْطَرُونَ وَلاَ يُمْطَرُ أَهْلُ الْمَدِينَةِ‏.‏
Reference : Sahih al-Bukhari 1015
In-book reference : Book 15, Hadith 10
USC-MSA web (English) reference : Vol. 2, Book 17, Hadith 128
  (deprecated numbering scheme)