The global transport sector has a significant share of greenhouse gas emissions. Thus, plug-in electric vehicles (PEVs) can play a vital role in the reduction of pollution. However, high penetration of PEVs can pose severe challenges to power systems, such as an increase in energy losses and a decrease in the transformers expected life. In this paper, a new day-ahead cooptimization algorithm is proposed to reduce the unwanted effects of PEVs on the power system. The aim of the proposed algorithm is minimizing the cost of energy losses as well as transformer operating cost by the management of active and reactive powers simultaneously. Moreover, the effect of harmonics, which are produced by the charger of PEVs, are considered in the proposed algorithm. Also, the transformer operating cost is obtained from a method that contains the purchase price, loading, and losses cost of the transformer. Another advantage of the proposed algorithm is that it can improve power quality parameters, e.g., voltage and power factor of the distribution network by managing the reactive power. Afterward, the proposed algorithm is applied to a real distribution network. The results show that the proposed algorithm optimizes the daily operating cost of the distribution network efficiently. Finally, the robustness of the proposed algorithm to the number and distribution of PEVs is verified by simulation results. Index Terms-plug-in electric vehicle (PEV), transformer aging, energy losses, daily operating cost reduction. NOMENCLATURE A. Indices and Sets ℎ Harmonic order ℎ Maximum harmonic order Set of power system nodes Time slot B. Plug-in Electric Vehicle and Parking Lot Parameters PEV battery capacity [kWh] Capacity of the n-th parking lot