The Gemara in Masechet Berachot (27) records a debate as to when the day ends with respect to the prayers of Minha and Arbit. Rabbi Yehuda held that the day ends at the point of Pelag Ha’minha – approximately one and a quarter hours before sundown – and thus Minha must be recited by that time, and Arbit may be recited already at that time. The Hachamim (majority of the Sages), however, maintained that the day ends at sundown. According to their view, one may recite Minha until sundown, and may not recite Arbit until after sundown.
The Gemara, after trying to determine which of these views should be followed, concludes, "De’abid Ka’mor Abid, De’abid Ke’mor Abid" – meaning, one may follow whichever opinion he chooses. One can choose to consider Pelag Ha’minha the end of the day, and begin reciting Arbit already at that time, or consider sundown the end of the day, and recite Minha until sundown.
The Shulhan Aruch (Orah Haim 233) codifies the Gemara’s conclusion, but adds that the accepted custom is in accordance with the view of the Hachamim. It is thus customary to allow reciting Minha until sundown, and to ensure not to recite Arbit until after sundown.
There are, however, several exceptions to this general rule. One such exception is a Halacha presented by the Shulhan Aruch himself (Orah Haim 267) regarding the Arbit service on Friday night. The Shulhan Aruch writes that it is customary to recite Arbit on Friday night before sundown. The obligation of "Tosefet Shabbat" requires accepting Shabbat several moments before the formal onset of Shabbat, which occurs at sundown, in order to extend the period of Shabbat observance. This requirement suffices as a "Halachic dispensation," as it were, to allow following Rabbi Yehuda’s position, and reciting Arbit before sundown on Friday evening. Of course, Arbit may not be recited before Pelag Ha’minha, which is considered the end of the day, and thus the earliest time for Arbit, according to Rabbi Yehuda’s view.
The Magen Abraham (Rabbi Abraham Gombiner, Poland, 1637-1683) adds another reason for this custom. The Arbit prayer service corresponds to the burning of the limbs and fats of the animal sacrifices in the Bet Ha’mikdash, which took place during the nighttime hours. On Friday night, however, this nighttime ritual was not performed. Accordingly, even the Hachamim would likely agree that on Friday night, Arbit may be recited even before sundown. Since the sacrificial limbs and fats were not offered on the altar during the nighttime hours on Friday night, the Arbit service may be recited even before the night.
It should be emphasized that the Shulhan Aruch presents this Halacha as "Le’chatehila," meaning, as applying even on the optimal standard of Halachic observance. It is perfectly acceptable to pray Arbit before sundown on Friday evening, even under normal circumstances. This ruling appears as well in the Kaf Ha’haim (work by Rav Yaakob Haim Sofer, Baghdad-Israel, 1870-1939), and it appears that this was also the view of the Arizal (Rav Yishak Luria of Safed, 1534-1572).
Summary: Generally speaking, Halacha considers sundown as the end of the day with regard to the daily prayer services, and therefore Minha may be recited until sundown, and Arbit may not be recited until after sundown. An exception to this rule is Friday night, when one is allowed to recite Arbit already from the point of Pelag Ha’minha (approximately one and a quarter hours before sundown), as is commonly done during the spring and summer.