It is a mitzva -- actually, an obligation -- to begin observing Shabbat each week before it officially starts. This concept is known as "Tosefet (or Tosfot) Shabbat," which means "adding to Shabbat." This requirement is derived from the Torah's description of Yom Kippur. The Torah actually states that the Yom Kippur fast is on the ninth of Tishrei, when in reality it is on the tenth of Tishrei. Our sages derive from here that one is required to begin Yom Kippur, Shabbat, and Yom Tov slightly earlier than they actually begin and to conclude them slightly later than they officially end.
Even a "Tosefet Shabbat" of just two minutes suffices to fulfill this important mitzva. Others suggest adding four minutes, five minutes, ten minutes, twelve minutes, fifteen minutes, eighteen minutes, or thirty minutes to one’s Shabbat observance. There is also the well-known Jerusalem custom of beginning Shabbat forty minutes before sunset. Nevertheless, the earliest one may accept Shabbat on Friday is the time of day known as "plag hamincha", which is one and a quarter halachic hours before sunset.
There is also some discussion on how one is to accept Shabbat upon oneself before it actually begins. According to some authorities, one must orally declare that one is accepting Shabbat and beginning to observe it. This is based on the view that a mental declaration without any verbal articulation is halachically meaningless and insignificant. Indeed, a number of authorities rule that one who only makes a mental commitment to begin Yom Kippur may continue eating (as long as it still before sunset) should one feel the need to do so. The required oral declaration can also be accomplished by simply reciting the Kabbalat Shabbat service. It seems that when accepting Shabbat upon themselves, some of the Chassidic masters would declare, “I hereby add holiness to the profane [weekday] in order to fulfill the mitzvah of Tosefet Shabbat, as the Creator Blessed be His Name has commanded us. And I hereby accept upon myself to fulfill all the positive commandments and all the negative commandments of Shabbat just as the Creator Blessed be His Name has commanded us in the Torah, as it says ‘Remember the Shabbat day to keep it holy’ and ‘Guard the Shabbat day to keep it holy as the Lord your God has commanded you.’”
Nevertheless, a mental declaration does have some weight in halacha and should not be hastily dismissed. Therefore, even one who merely made a mental declaration to accept Shabbat in fulfillment of "Tosefet Shabbat" should not perform any melacha even if it is still before sunset. Indeed, one's acceptance of Shabbat or Yom Tov is binding even if one notices that it is actually much earlier than one had thought. One should preferably recite mincha before accepting Shabbat. This is because once one accepts Shabbat, it is questionable whether one may now recite the “Friday” mincha.
Women and girls should also endeavor to fulfill the mitzva of Tosefet Shabbat. Women who light Shabbat candles automatically fulfill the mitzva of Tosefet Shabbat. This is because the Shabbat candles are always lit before sunset. Once the candles are lit and the blessing is recited, a woman has accepted Shabbat upon herself and may no longer do any melacha. Men who light Shabbat candles are not obligated to accept Shabbat at that time.
Unfortunately, many individuals are lax with the mitzva of Tosefet Shabbat and simply allow Shabbat to commence automatically at sunset. A number of authorities justify this laxity by suggesting that one fulfills the mitzva of Tosefet Shabbat even without articulating it. According to this approach, one fulfills the mitzva of Tosefet Shabbat by simply refraining from performing any melacha shortly before sunset. Nevertheless, it is extremely meritorious to formally accept Shabbat upon oneself before it officially starts and one should make an effort to do so.
 See Shabbat 118b; Kol Bo 31; Or Hachaim, Shemot 31:16.
 Yoma 81b; OC 261:2, 263:1, 293:1; Mishna Berura 299:33.
 Eretz Tzvi 70; Igrot Moshe, OC 1:96. See also Yabia Omer 5:21.
 Avnei Nezer 498.
 Minchat Elazar 1:23.
 Igrot Moshe, OC 2:6.
 Siddur Yaavetz; Ben Ish Cha, Vayeira.
 Mishna Berura 261:22; Machzor Divrei Yoel, Zemirot Divrei Yoel.
 See Halacha Bilvad p. 29 for the origins of this custom.
 Shita Mekubetzet, Beitza 30a; Be'er Heitev, OC 261:6.
 Rema, OC 261:2. But see Aruch Hashulchan, OC 263:19 who allows one to accept Shabbat even earlier than this time.
 Mishna Berura 261:21, Or L'tzion 2:18.
 Rema, OC 553:1, 608:3.
 OC 261:4; Mishna Berura 261:21,31; Rivevot Ephraim 8:595:2.
 Mishmeret Shalom 26:2.
 Mishna Berura 553:2; Aruch Hashulchan, OC 261:2; Chayei Adam 5:2; Yabia Omer 7:34. See also CM 212:8; Rema, YD 258:13.
 Shemirat Shabbat Kehilchata 46:2.
 OC 263:10.
 OC 263:15; Mishna Berura 263:43; Mishmeret Shalom 26:3,4; Rivevot Ephraim 1:187, 2:122, 3:590:25, 4:69, 7:279; Avnei Yashfei 1:56; Eretz Tzvi 60; Minchat Yitzchak 9:20; Tzitz Eliezer 13:42.
 Rivevot Ephraim 4:65; 4:69:4.
 Rema, OC 263:10; Kaf Hachaim, OC 261:16; Aruch Hashulchan, OC 263:13; Ketav Sofer, OC 56. In rare circumstances, a woman may perform melacha after lighting the Shabbat candles if an explicit stipulation to do so was made before she lit the candles. See Mishna Berura 263:44 and Shemirat Shabbat K’hilchata Chapter 43 note 136.
 Mishna Berura 263:42.
 Yabia Omer 7:34; Shevet Halevi 1:50; Minhag Yisrael Torah, OC 261:2.
 For more on Tosefet Shabbat see my Halacha Bilvad p.31 and Devar Chevron 2:238.