Shabbat lasts from nightfall to nightfall—as does every Jewish calendar date. But when exactly is nightfall? When the sun sets or when darkness sets in? Well, this is an age-old question, a halachic grey area. So we cover all our bases just to be safe. We begin observing a calendar date before sunset and it lasts until after the stars appear the following night. (For more on this topic, see Days.)
Additionally, there is a mitzvah to "add from the profane to the holy." In simple words, this means that we celebrate Shabbat and Jewish holidays for at least a bit longer than the prescribed time, to show how precious these days are to us.
Rabbi Menachem Posner