Determining the time for starting Shabbat is relatively simple – as we know, we begin Shabbat 18 minutes before sunset, in fulfillment of the requirement of Tosefet Shabbat (adding time onto Shabbat). The time for ending Shabbat, however, is less clear. The Gemara instructs that Shabbat ends when three medium-sized stars are visible in the sky. Later Rabbis figured that since people nowadays cannot distinguish between the stars of different sizes, we should wait until the sighting of three small stars. Of course, this does not help much, either, because most of us cannot identify small stars, and, besides, in many places the stars are not visible because of artificial lighting, and on some nights the stars are not visible because of cloud cover.
The standard custom follows the view of the Vilna Gaon (Rav Eliyahu of Vilna, 1720-1797), based on the Geonim, that the period of Ben Ha’shemashot (Halachic "twilight") begins after what we call sunset – when the entire sun dips below the horizon – and Shabbat ends after Ben He’shemashot. In Israel, where it becomes dark rather quickly after sundown, Ben Ha’shemashot is presumed to be approximately 20 minutes, whereas here in Tri-State Area, the period of Ben Ha’shemashot ranges from 40 to 50 minutes, depending on the time of year. Rav Moshe Feinstein (Russia-New York, 1895-1986) maintained that in this area, it is preferable to wait until 50 minutes after sunset all year round. Some people end Shabbat 35 minutes after sunset, but this practice is incorrect, as it follows the custom observed in Halab (Aleppo, Syria), where it becomes dark sooner after sunset than it does here in our area.
According to the accepted custom, then, Shabbat ends some 40-50 minutes after sunset, depending on the time of year.
The Shulhan Aruch (Yoreh De’a 261), however, follows a different opinion regarding the conclusion of the Halachic day. He accepts the position of Rabbenu Tam (Rav Yaakob Tam, France, 1100-1171), who ruled that the point which we call sunset begins the onset of Halachic sunset, which concludes only 58.5 minutes later. Only then does the 13.5-minute period of Ben Ha’shemashot begin, such that the onset of Halachic night does not occur until 72 minutes after sunset. The Shulhan Aruch rules that one can begin Shabbat anytime on Friday evening until close to one hour after sunset (though several minutes must be added for Tosefet Shabbat). This would mean that if, in the summertime, the sun sets at 8:28pm, one may accept Shabbat as late as 9:20pm or so.
Of course, common practice does not follow this opinion, and requires accepting Shabbat before sunset, just as common practice does not follow this opinion with regard to the end of Shabbat, and does not require waiting until 72 minutes after sunset to end Shabbat.
However, Hacham Ovadia Yosef writes (in Yabia Omer, vol. 2, and in Yalkut Yosef) that it is proper for those who are meticulous in their Halachic observance to follow this stringency when it comes to ending Shabbat. Violating Shabbat constitutes a capital offense, and Hacham Ovadia counts no fewer than 30 Rishonim (Medieval sages) who agree with Rabbenu Tam’s understanding of the conclusion of the Halachic day. And so, although common practice follows the Geonim’s view, those who seek to be meticulous in their Halachic observance should follow Rabbenu Tam’s view, and end Shabbat only 72 minutes after sundown. Hacham Ovadia writes that this applies primarily to acts which are forbidden on Shabbat by force of Torah law. Due the special gravity of Shabbat desecration, these acts should, preferably, not be performed until 72 minutes after sundown. When it comes to acts that are forbidden only Mi’de’rabbanan (by force of Rabbinic enactment), there is greater room to permit ending Shabbat 40-50 minutes after sundown.
Hacham Ovadia notes that a number of prominent Poskim made an effort to impress upon people the importance of delaying the end of Shabbat until 72 minutes after sundown. Some, such as Rav Haim Abulafia and Rav Shmuel Laniado imposed a Herem (edict of excommunication) upon those who ended Shabbat earlier. Hacham Ovadia said that he would not go that far in enforcing this policy, but he does encourage people to follow this opinion of Rabbenu Tam and many other Rishonim. Other prominent Rabbis who urged people to adhere to this ruling include Hacham Eliyahu Shama Ha’levi (Chief Rabbi of Aleppo, d. 1814), Rav Yosef Haim Sonnenfeld (1848-1932), and Rav Isser Zalman Meltzer (1870-1953).
Rav Yaakob Paragi (17th century), a Rabbi in Egypt, wrote in a responsum that he tried for 50 years to convince his community to end Shabbat according to the view of Rabbenu Tam, but not even his wife followed this practice. He finally decided to give up, until he was told in a dream that this is an important matter that is worth continuing to advocate for.
Hacham Shalom Mesas (Morocco-Jerusalem, 1909-2003), interestingly enough, disagreed with Hacham Ovadia in this regard, insisting that it is perfectly legitimate to follow the widely-accepted custom, and that there was no need to urge people to follow the stringent view of Rabbenu Tam. But Hacham Ovadia countered that since so many Rishonim agreed with Rabbenu Tam, and we are dealing with the possibility of Shabbat desecration, stringency on this matter should be encouraged.
(There is a separate question as to whether Rabbenu Tam’s view requires waiting 72 minutes, or if perhaps he requires waiting longer during the summer months. Hacham Ovadia seems to imply that in the summertime, Rabbenu Tam requires waiting as much as 90 minutes after sunset. This issue, however, requires a separate discussion.)
Summary: The accepted custom is to end Shabbat in the Tri-State Area around 40-50 minutes after sunset. Although this is an acceptable practice, it is proper to refrain at least from activities which are forbidden on Shabbat on the level of Torah law until 72 minutes after sunset.