There are three major challenges to the broad implementation of energy storage systems (ESSs) in urban rail transit: maximizing the absorption of regenerative braking power, enabling online global optimal control, and ensuring algorithm portability. To address these problems, a coordinated control framework between onboard and wayside ESSs is proposed in this study, and the related control strategy is obtained by transforming the global optimization problem into a combination of rule-based and local optimization problems. The design process of the strategy is divided into three parts: offline optimization, rule extraction, and local optimization. First, a genetic algorithm is used to optimize the charge/discharge threshold curves under typical operational conditions. Then, the rules of offline optimization results are obtained from an expert system, and the nonlinear rules are mined with local optimization methods. Finally, a coordinated strategy is presented based on the outcomes of the three parts. A power hardware-in-the-loop (PHIL) experimental platform based on RTLAB is built, and the above coordination strategy is verified based on data for the Beijing Metro Batong Line. The experimental results show that the strategy can effectively improve the energy-saving rate and reduce the regeneration failure rate substantially, with the effect being close to the offline global optimal solution. The algorithm proposed in this paper achieves near global optimal energy-saving optimization results with lower computational costs, and has strong portability, providing a good solution for the large-scale application of onboard and wayside energy storage coordination control.