The Foxborough Branch Railroad was incorporated in 1862 to provide a rail connection from Mansfield through Foxborough to Walpole. In 1867, it became the Mansfield and Framingham Railroad, with a new charter allowing it to connect to the Boston, Clinton and Fitchburg Railroad and Boston and Worcester Railroad at Framingham. The line was completed on May 1, 1870. On January 1, 1873, it was leased to the Boston, Clinton and Fitchburg Railroad for fifty years, before merging with that railroad on June 1, 1875.
Passenger service ceased in 1933. The line passed to Penn Central and Conrail, and was assigned to CSX Transportation as its Framingham Subdivision in the 1999 breakup of Conrail. Effective June 17, 2015, the state purchased the line for $23 million with the intent to upgrade it for faster game day service and eventual full-time passenger service.[6] By 2021, 17 miles (27 km) of continuous welded rail had been installed.[7]