عَنْ أَبِي هُرَيْرَةَ رَضِيَ اللهُ عَنْهُ قَالَ: قَالَ رَسُولُ اللهِ صَلَّى اللهُ عَلَيْهِ وَسَلَّمَ: «لَا تَقَدَّمُوا رَمَضَانَ بِصَوْمِ يَوْمٍ وَلَا يَوْمَيْنِ إِلَّا رَجُلٌ كَانَ يَصُومُ صَوْمًا فَلْيَصُمْهُ».
The Prophet (may Allah's peace and blessings be upon him) forbade Muslims from fasting a day or two ahead of Ramadan out of cautiousness for Ramadan, because the obligation of fasting Ramadan is based on sighting the crescent, and there is no need for affectation. However, if someone has a habitual fast, such as fasting every other day or fasting on Mondays or Thursdays, and it coincides with this time, then he may fast. This is not considered a part of anticipating Ramadan.
This also applies to obligatory fasts, such as making up for missed fasts or fulfilling a vow.
Download for free and never miss a prayer again