Electrical railway systems (ERSs) are one of the largest end-users in the utility grid. Providing optimal energy management and improving efficiency in such a high-power network is a vital approach to conserve energy and decrease economic costs. Meanwhile, proper exploitation of regenerative braking energy (RBE) as a dormant potential in ERSs, is a distinguished opportunity to achieve these goals. This paper presents a proposal to achieve the mutual advantages of RBE harvesting and energy storage systems (ESSs). In the proposed strategy, a multifunctional railway power conditioner (MF-RPC) together with its smart control system is employed to realize the optimal mode of the active and reactive powers exchange in output ports. Depending on the motoring and generating powers of trains on both sides of traction substation (TSS), the proposed MF-RPC can simultaneously restore back RBE to the grid, save energy in ESSs and power other adjacent consuming trains. Regarding the intrinsic features of MF-RPC, all proposed scenarios are consistent with power quality standards. The simulation results based on MATLAB/SIMULINK are provided to confirm the effectiveness of the proposed method.