The Duns Branch and the Berwickshire Railway together formed a through railway route from Reston, near Berwick-upon-Tweed, to St Boswells in the Scottish Borders. The line was promoted in two stages. The first was from Reston on the Edinburgh to Berwick main line to Duns (then spelt Dunse, and the county town of Berwickshire); it opened by the North British Railway in 1849.
The second section was promoted independently by the Berwickshire Railway Company, but with considerable assistance from the North British Railway. It opened most of its line in 1863, but delay in constructing a large viaduct, Leaderfoot Viaduct, led to the opening of the final section of the line being delayed until 1865.
The North British Railway had conceived the line as a strategic trunk route across southern Scotland, but this development was never realised, and the line was never heavily used.
During the violent rainstorm in the area in August 1948 the line was breached west of Earlston, and the passenger train service ceased permanently. Duns reverted to being a branch line terminus from Reston until that too was closed to passengers in 1951.