The ever-growing participation of Renewable Energy Sources (RES) in modern distribution networks is replacing an important portion of Conventional Generation (CG), which brings along new challenges in the planning and operation of distribution grids. As RES such as Photovoltaic Energy (PV) and Wind Power Generation (WPG) increase in distribution networks, studies regarding their integration and coordination become more important. In this context, the purpose of this paper is to propose a Multi-period Optimal Power Flow (MOPF) model for the optimal coordination of Battery Energy Storage Systems (BESSs) with PV, WPG, and CG in modern distribution networks. The model formulation was developed in A Modeling Language for Mathematical Programming (AMPL) and solved through the Knitro solver within a time horizon of 24 h. A distinctive feature and one of the main contributions of the proposed approach is the fact that BESSs can provide both active and reactive power. The proposed optimization model reduces power losses and improves voltage profiles. To show the applicability and effectiveness of the proposed model, several tests were carried out on the 33-bus distribution test system and a real distribution system of 141 buses located in the metropolitan area of Caracas. Power loss reductions of up to 58.4% and 77% for the test systems of 33 and 141 buses were obtained, respectively, when BESSs provided both active and reactive power. The results allow us to conclude that the proposed model for optimal coordination of BESSs with RES is suitable for real-life applications, resulting in important reductions of power losses and flattening of voltage profiles.