The optimal sizing of on-board and wayside energy storage systems in urban rail transit, considering the effect of regenerative braking energy recovery, is studies in this paper. Firstly, the original braking resistors are replaced by on-board energy storage systems with the constraints of weight and volume. Then to evaluate the trade-off between component cost and operational cost, an optimization problem, which integrates sizing and energy management of on-board and wayside energy storage systems, is introduced and formulated in terms of daily cost. Finally, a case study of Batong Line in Beijng is carried out to validate the above proposed approach and Gurobi is applied to obtain a computationally tractable solution for the model. Results show the effectiveness of the optimal model.