To ensure the efficient operation and low maintenance costs of high-speed railway lines, a collaborative real-time optimization strategy for train rescheduling and track emergency maintenance is proposed in this paper. This strategy not only makes online decisions on the track emergency maintenance, but simultaneously deals with the delays caused by the track emergency and disturbances. Based on a bi-directional railway line, a mixed-integer nonlinear optimization model is established, in which the decision variables mainly include the track maintenance intervention type, the end time of track maintenance, arrival/departure time, arrival/departure orders, stopping plans, and train cancellations. The proposed nonlinear model is converted to an equivalent linear model by a linearization method to reduce the computational burden. Moreover, a Lagrangian relaxation-based decomposition algorithm under a rolling horizon framework is designed to satisfy the real-time performance further. Particularly, the rolling horizon framework divides the whole time horizon into three stages according to the status of the maintenance work, i.e., the maintenance decision-making stage, the maintenance stage, and the maintenance completion stage. Furthermore, the Lagrangian relaxation-based algorithm decomposes the original large-scale optimization problem into several smaller sub-problems, which can be computed in parallel to improve the solution procedure. This designed algorithm not only reduces the computation effort for the real-time implementation, but also realizes online feedback correction and improves the robustness of the control strategy. Several numerical experiments are carried out based on the data of Beijing-Shanghai high-speed railway to demonstrate the feasibility and effectiveness of the proposed strategy.