To balance the limited capacity and constantly changing demand in the high-speed rail network, a transport capacity optimization problem is investigated by adjusting train composition through uncoupling/coupling operations at the origin station, scheduling additional trains from the capacity pool, and optimizing the seat allocation among ODs. To make joint decisions, a two-stage stochastic programming model is formulated to minimize both operating cost and penalty cost for unsatisfied passengers, while incorporating various constraints such as flow conservation, loading capacity, flexible composition, etc. The two-stage model is linearized into a mixed-integer linear programming model, which can be effectively solved for small networks but is still intractable to solve for realistic networks. Therefore, a Lagrangian relaxation algorithm is proposed integrating parallel computing and sub-gradient method. Finally, two sets of case tests, including a toy network and a real-world case of a high-speed rail network in China, are implemented to show the performance of the proposed approach. The results illustrate that the parallel heuristic algorithm could generate a high-quality solution with a slight discrepancy from the optimal solution, while achieving a commendable computation time. Furthermore, the findings emphasize the advantages of applying flexible train composition and additional capacity pool in the high-speed railway system for cost-saving and supply–demand matching.