A quick response to a shock Barnsley opener and then a late flourish earned Boro a 3-1 win in their final home fixture of the season.
Boro dominated the first half but Barnsley took the lead early in the second as Jean-Yves M'voto hooked home from a corner, but the home side levelled within 60 seconds as Lee Tomlin drilled home.
Then in a lively finish Boro went ahead in the final minute through Danny Graham before Tomlin wrapped it up deep in stoppage time.
Boro's first chance came on eight minutes as winger Adam Reach robbed defender M'voto on the edge of the box and rifled just over.
Barnsley went close on 12 minutes as Marcus Pedersen's cross from the left was deflected and sent keeper Dimi Konstantopoulos full length to save.
After that Boro started to gradually build up the pressure.
On 32 minutes Reach had an angled shot blocked by defender Kelvin Etuhu and Tomlin rifled the rebound into the chest of keeper Luke Steele.
Then in a flurry of action, Tomlin had a 20-yard effort parried and Reach lashed the rebound wide. Albert Adomah then sent a weak curling effort straight at the keeper.
Boro went close on 42 minutes as Reach had a 20-yard effort parried and immediately after that, Butterfield's low shot sent the keeper full length to tip behind.
And on the stroke of half-time Butterfield crossed for Daniel Ayala to stab goalwards but again Steele saved well.
Tomlin slotted into Reach in a good position in the box but he checked inside and then back again before being closed down and playing it back for Graham to fire over.
Boro started brightly after the break but Barnsley snatched an opener against the run of play on 53 minutes.
They won a corner and when Boro failed to clear Martin Cranie's flag-kick it bounced through to M'voto, who hooked it beyond the dive of Konstantopoulos and inside the far post.
But Boro hit back within a minute as Tomlin seized on a loose ball on the edge of the box and drilled a a low shot inside the far post on 54 minutes.
Barnsley had a good chance on 78 minutes as a cross came in from the left for Nick Proschwitz to fire over when he had time and space to pick his spot.
Boro should have sealed victory on 85 minutes as Nathaniel Chalobah squared for Tomlin in the box but the keeper charged out to block.
But Boro grabbed the lead on 90 minutes when an Adomah shot was blocked and the rebound fell to an unmarked Graham, who slammed home from eight yards out.
And Boro wrapped it up three minutes into stoppage time as Tomlin played a one-two with Adomah to get into the box then drilled home.