أحصوا هلال شعبان لرمضان ولا تخلطوا برمضان إلا أن يوافق ذلك صياما كان يصومه أحدكم, وصوموا لرؤيته وأفطروا لرؤيته فإن غم عليكم فأكملوا العدة ثلاثين يوما فإنها ليست تغمى عليكم العدة» .
(صحيح) . قط هق عن أبي هريرة. الصحيحة 565)
It is reported that the Messenger of Allah (peace and blessings of Allaah be upon him) said:
“Count (the days and keep track of) the crescent in Sha’ban (in order to determine the coming) of Ramadan , and do not mix (it) with Ramadan, unless it coincides with the day when one of you (usually) fasts. Start fasting as soon as you see (crescent) and end the fast as soon as you see it. If it was not clear to you (when exactly the crescent appeared), then bring the number (of days) to thirty days, for this  is known to you .”
This hadith was narrated by ad-Darakutni (2198) and al-Bayhakyi (4/206) from the words of Abu Hurayra, may Allah be pleased with him.
Sheikh al-Albani called the hadith authentic. See Sahih al-Jami ‘as-saghir (199), al-Silsilah al-sahiha (565).
 That is, counting off thirty days removes doubts about the end of the month.