Praise be to Allah.
It was proven that the Prophet (peace and blessings of Allaah be upon him) said: “When Sha’baan is halfway through, do not fast.” Narrated by Abu Dawood (3237); Ibn Hibaan (1651); classed as saheeh by al-Albaani in Saheeh al-Tirmidhi.
There are some exceptions from this prohibition, as follows:
1 –One who has a habit of fasting, such as a man who habitually fasts on Mondays and Thursdays, which he may do even after halfway through Sha’baan. The evidence for that is the words of the Prophet (peace and blessings of Allaah be upon him), “Do not anticipate Ramadaan by fasting one or two days before it, except a man who fasts regularly, who should observe his usual fast.” Narrated by al-Bukhaari, 1914; Muslim, 1082.
2 – A person who started fasting before halfway through Sha’baan, and connects what comes after the halfway point to what came before. This is not included in the prohibition either. The evidence for that is the words of ‘Aa’ishah (may Allaah be pleased with her) who said: “The Messenger of Allaah (peace and blessings of Allaah be upon him) used to fast all of Sha’baan and fast all of Sha’baan except a little.” Narrated by al-Bukhaari, 1970; Muslim, 1165. This version narrated by Muslim.
Al-Nawawi said: “He used to fast all of Sha’baan and fast all of Sha’baan except a little.” The second phrase is an explanation of the first, pointing out that by “all” what is meant is “most”.
This hadeeth indicates that it is permissible to fast after halfway through Sha’baan, but only for one who joins that to what came before the halfway point.
3 – An exception from this prohibition is also made for one who is making up missed Ramadaan fasts.
Al-Nawawi (may Allaah have mercy on him) said in al-Majmoo’ (6/399):
Our companions said: it is not correct to fast on the “day of doubt” just before Ramadaan, and there is no difference of scholarly opinion on this point … But if a person fasts it to make up a missed day or to fulfil a vow, or as an expiation, that is acceptable, because if it is permissible to observe a voluntary fast on that day, it is more likely to be permissible to observe an obligatory fast… and if a person has to make up a day from Ramadaan, then he has to fast it, because the time left for him to make it up has become very short.
The “day of doubt” is the thirtieth of Sha’baan if it has not been possible to sight the moon of the thirtieth because of cloud, fog, etc. It is called the “day of doubt” because there is some doubt concerning it – is it the last day of Sha’baan or the first day of Ramadaan?
There is nothing wrong with making up a missed Ramadaan fast in the last half of Sha’baan. This is not included in the prohibition of the Prophet (peace and blessings of Allaah be upon him) on fasting after halfway through Sha’baan.
So your fasting of those three days is valid, and you have to fast the remaining days before Ramadaan begins.
And Allaah knows best.