The Boston and Albany Railroad (reporting mark B&A) was a railroad connecting Boston, Massachusetts to Albany, New York, later becoming part of the New York Central Railroad system, Conrail, and CSX Transportation. The line is currently used by CSX for freight. Passenger service is provided on the line by Amtrak, as part of their Lake Shore Limited service, and by the MBTA Commuter Rail system, which owns the section east of Worcester and operates it as its Framingham/Worcester Line.

When the Erie Canal opened in 1825, New York City's advantageous water connection through the Hudson River threatened Boston's historical dominance as a trade center. Since the Berkshires made construction of a canal infeasible, Boston turned to the emerging railroad technology for a share of the freight to and from the Midwestern United States. The Boston and Worcester Railroad was chartered June 23, 1831 and construction began in August 1832. The line opened in sections: to West Newton on April 16, 1834; to Wellesley on July 3; to Ashland on September 20; to Westborough in November 1834; and the full length to Worcester on July 4, 1835. The original single-track line was double-tracked from Boston to Framingham in 1839, and on to Worcester by 1843. In 1843 the B&W introduced season passes to West Newton for $60, effectively introducing the concept of commuter rail.

The Western Railroad was chartered February 15, 1833 and incorporated March 15, 1833 to connect the B&W to the Hudson and Berkshire Railroad at the New York state line. Construction began in 1837, and the Eastern Division to the Connecticut River in Springfield opened on October 1, 1839. The summit of Charlton Hill drainage divide between the Atlantic coast and the Connecticut River is a rock cut 57 mi (92 km) west of Boston. The Western Division, through the Berkshire Hills, opened in sections from both ends from the state line to Pittsfield May 4, 1841, West Springfield to Chester May 24, 1841, Springfield to West Springfield (across the Connecticut River) July 4, 1841, Pittsfield to "Summit" August 9, 1841, and Chester to Summit September 13, 1841. The summit through the Berkshires is known as Washington Hill. Eastbound trains climb 6 mi (9.7 km) of 1.4% grade while westbound trains climb 10 mi (16 km) of slightly steeper grade to reach the 4 mi (6.4 km) of fairly level track across the drainage divide between the Connecticut and Hudson Rivers. On October 4, 1841, the first train ran along the full route. The only true tunnel on the B&A is State Line Tunnel in Canaan, New York, about 2 mi (3.2 km) west of the Massachusetts state line. The original bore was augmented by an improved-alignment second tunnel in 1912, and the original bore was abandoned in the late 20th century.

The Castleton and West Stockbridge Railroad was incorporated in New York in 1834 as the New York part of the Western Railroad, and changed its name to the Albany and West Stockbridge Railroad (chartered May 5, 1836, organized May 20). Construction began in December 1840 and the line opened from Greenbush (east of Albany) to Chatham on December 21, 1841, and to the Massachusetts state line on September 12, 1842. It was leased to the Western Railroad for 50 years from November 11, 1841. This railroad replaced the Hudson and Berkshire Railroad east of Chatham, which was abandoned around 1860.

The connection from Boston to Albany formed the longest and most expensive point-to-point railroad yet constructed in the United States.[2] Two mergers, on September 4, 1867, and December 28, 1870, brought the three companies, along with the Hudson and Boston Railroad, together into one company, known as the Boston and Albany Railroad. The New York Central and Hudson River Railroad leased the B&A for 99 years from July 1, 1900. This lease passed to the New York Central Railroad in 1914; throughout this, the B&A kept its own branding in the public eye. The NYC merged into Penn Central on February 1, 1968.

New York Central began a major modernization program in 1924. The Castleton Cut-Off with a very large hi-level bridge over the Hudson River was built from the B&A at Post Road to a new rail yard at Selkirk, New York, to avoid the steep NYC grade from the Hudson River up West Albany Hill. Berkshire locomotives were designed to provide faster freight service over the B&A.

In 1883, the B&A acquired track then owned by the New York and New England Railroad as far as Newton Highlands, and, in 1884, began the construction of a line northwest to the B&A mainline, creating a commuter loop. "The Circuit," as this route was called, officially opened in May 1886, providing double-track operation from downtown Boston through Brookline to Newton Highlands, then north into Riverside, and four tracks on the mainline from Riverside back to downtown so that commuter and mainline operations did not conflict. By 1889, as many as 35 trains traveled the Circuit daily, providing commuter service.

In 1899, the new South Station union station opened in Boston, a few blocks northeast of the old terminal. That terminal had been located on the west side of Utica Street (Boston, from Kneeland Street south to Harvard Street, now part of the South Bay Interchange. Even earlier, the terminal was in the block bounded by Kneeland Street, Beach Street, Albany Street (now Surface Artery), and Lincoln Street.

By the early part of the 20th century, commuter rail service was provided east of Worcester, with intercity rail continuing on west. During the 1940s period of peak passenger volume, the New Haven Railroad (with the cooperation of the New York Central) ran several Boston-New York City trains along the route to Worcester and Springfield and then south. The service included an overnight train with sleeping car service. The last passenger service on the line on April 30, 1971, before the creation of Amtrak was an unnamed Chicago-bound successor to the New York Central's New England States. The intercity trips were taken over by Amtrak on May 1, 1971, and, on January 27, 1973, the MBTA acquired the line east of Framingham. Service beyond Framingham was discontinued October 27, 1975, as the state did not subsidize it. Conrail took over Penn Central on April 1, 1976. On September 26, 1994, some rush hour trains started to serve Worcester on Conrail trackage (which became CSX trackage on June 1, 1999), extending to other times beginning on December 14, 1996. The MBTA acquired the rest of the line from Framingham to Worcester as part of an agreement announced in 2009. As part of the deal, clearances on the line west of Interstate 495 were improved, permitting full double stack service from Selkirk Yard in New York to an expanded CSX intermodal freight facility in Worcester and a transload facility near I-495. The deal was closed on June 17, 2010. CSX's Boston Subdivision retains the right to use certain MBTA-owned track.

Since 1959, the former "Circuit" line, later called the Highland branch, has been used as the grade-separated right-of-way of the MBTA's Green Line D branch light rail line.