Language:

Narrated Anas:

A man came to the Prophet (ﷺ) on a Friday while he (the Prophet) was delivering a sermon at Medina, and said, "There is lack of rain, so please invoke your Lord to bless us with the rain." The Prophet (ﷺ) looked at the sky when no cloud could be detected. Then he invoked Allah for rain. Clouds started gathering together and it rained till the Medina valleys started flowing with water. It continued raining till the next Friday. Then that man (or some other man) stood up while the Prophet (ﷺ) was delivering the Friday sermon, and said, "We are drowned; Please invoke your Lord to withhold it (rain) from us" The Prophet smiled and said twice or thrice, "O Allah! Please let it rain round about us and not upon us." The clouds started dispersing over Medina to the right and to the left, and it rained round about Medina and not upon Medina. Allah showed them (the people) the miracle of His Prophet and His response to his invocation.

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