Praise be to Allah.
Offering prayers for rain (salaat al-istisqa’) is Sunnah, as confirmed by saheeh hadeeths and the practice of the early generations of Islam. Ibn Qudaamah said: Prayer for rain is a confirmed Sunnah, proven by the practice of the Messenger of Allah (blessings and peace of Allah be upon him) and of his successors (the caliphs – may Allah be pleased with them).
End quote from al-Mughni, 2/148
Abu Dawood (1165), at-Tirmidhi (558), an-Nasaa’i (1506) and Ibn Maajah (1266) narrated that Ishaaq ibn Abdillah ibn Kinaanah said: al-Waleed ibn ‘Uqbah, who was the governor of Madinah, sent me to ask Ibn ‘Abbaas about the prayer of the Messenger of Allah (blessings and peace of Allah be upon him) for rain (istisqa’). He said: The Messenger of Allah (blessings and peace of Allah be upon him) went out wearing modest clothes, walking humbly and beseeching Allah, until he reached the prayer place, where he ascended the minbar, but he did not give a khutbah like this khutbah of yours; rather he continued to offer supplication (du‘aa’), beseech Allah and recite takbeer, then he prayed two rak‘ahs as he used to pray at Eid.
Classed as hasan by al-Albaani in Saheeh Abi Dawood, etc
See also the answer to question no. 26167
And Allah knows best.