Ben House netted twice to put the Royals 2-0 up after 28 minutes, before Josh Barrett made it 3-0 and seemingly out of the hosts' reach.
But George Miller and Marcus Tavernier pulled it back to 3-2 with 17 minutes left.
Ryan East struck the decisive fourth for Reading, before Lewis Wing set up a tense finale with Boro's third and Tavernier was sent off for a challenge on House in stoppage time.
Reading moved up to third place with the win, five points behind league leaders Boro.
The Royals face Aston Villa, in fourth, next on Monday 23 October. Boro visit Brighton & Hove Albion three days earlier.