Welcome to Embrace Shabbat.
The Sefer Yafei LaLev (nefesh yetaira b’Shabbat, Letter 25) quotes from the Yalkut Reuveni that Shabbat was created before the six days. The passuk states: ששת ימים עשה, [G-d made] six days. Interestingly, it doesn’t say say בששת ימים עשה, in six days [He] created, but that He created “six days.” Each day was its own individual creation, including Shabbat. Although Shabbat occurs last in the week, it was actually created before the entire world. As it says in Parshat Yitro, זכור את יום השבת לקדשו, remember Shabbat and make it holy. The passuk continues ששת ימים עשה. It mentions Shabbat before the six days because Shabbat was actually created first. Why?
The Sefer Yafei LaLev is bothered by a question from the Sefer Shemen Sasson in his commentary on the Arizal Shaar HaKavanot. The three days prior to Shabbat- Wednesday, Thursday, and Friday- get their Kedusha from the upcoming Shabbat. Similarly, Sunday, Monday, and Tuesday get their kedusha from the previous Shabbat. So, what happened at the beginning of creation? How were the first three days of creation able to exist without the kedusha from the prior Shabbat. Where did they get their source of life from?
This idea from the Sefer Yafei LaLev sheds light on the issue. Shabbat was in existence prior to creation and therefore the first three days got kedusha from Shabbat.
Shabbat is not only the end goal, but the intention from the beginning. Everything throughout the week stems from Shabbat.
אך את שבתותי תשמורו- the Jewish people must keep two Shabbats in order for the geula to come. Why?
We need a Shabbat as the source of kedusha for Sunday, Monday, and Tuesday, and a Shabbat that is the source of kedusha for the Wednesday, Thursday, and Friday preceding it. The Jewish people must keep two Shabbats because the entire week gets its nourishment from the Shabbat before and the Shabbat afterward.
Have a wonderful day and a Shabbat Shalom.

