Transfers are a major source of travel time variability for transit passengers. Coordinating transfers between transit routes in real time can reduce passenger waiting times and travel time variability, but these benefits need to be contrasted with the delays to on-board and downstream passengers, as well as the potential for bus bunching created by holding buses for transfers. We developed a dynamic holding strategy for transfer coordination based on control theory. We then obtained the optimal control strategy, where maximum holding time is a function of real-time estimates of bus arrivals and passengers and the uncertainty in these estimates. Total travel time (waiting plus in-vehicle) with the optimal control is found to be globally less than or equal to total travel time without control when uncertainty is bounded. The time savings from transfer coordination increase with the ratio of transferring to through passengers but diminish as uncertainty in the real-time estimates of bus arrivals increases. Field observations at a multimodal transfer point in Oakland show that the proposed control strategy could reduce net transfer delay by 30-39% in a real-world scenario. The data collected also confirm that the upper bound on uncertainty in bus arrivals can be satisfied with existing bus location technology. We conclude with a discussion of complementary measures, such as the provision of real-time information at transfer points and conditional signal priority, which could allow coordination to be applied in more cases.