A dull opening was brought to life when Alexis Sanchez's superb free-kick gave Arsenal the lead just before the break.
Middlesbrough responded soon after the restart when Alvaro Negredo volleyed in Stewart Downing's pinpoint cross.
However, Mesut Ozil secured the much-needed three points for Arsenal with a first-time strike at the near post.
The win - only Arsenal's third in their past nine league games - moves the Gunners up to sixth, seven points behind fourth-place Manchester City and with a game in hand.
Middlesbrough remain deep in relegation trouble, six points from safety.
The Gunners have not lost five successive away games in the league since 1984 and manager Arsene Wenger took significant measures to avoid that happening against Boro by playing a three-man defence for the first time since 1997.
Rob Holding, Laurent Koscielny and Gabriel were the centre-backs at the Riverside Stadium but struggled with the change in system as Middlesbrough looked lively in the early stages but lacked the quality in the final third to exploit the gaps in Arsenal's defence.
"Yes, it is the first time in 20 years. That shows you that even at my age, you can change," Wenger said after the game when explaining his tactical switch.
"I felt it added a bit more stability on the long balls. We faced a direct game and we have been punished a bit on that. It gave the opponents more of the ball but against Crystal Palace we had 70% possession but lost."
Middlesbrough have scored the fewest amount of Premier League goals at home all season - just 12 prior to Arsenal's visit - and with the quality of Sanchez and Ozil in attack the visitors were always capable of snatching a lead. That proved to be the case when they scored from only their second shot on target just before the break, Sanchez expertly steering a free-kick over a packed wall and into the far corner.
Arsenal's lack of experience playing 3-4-3 was evident early in the second half when Downing charged away down an exposed right flank on the counter before providing the perfect ball for Negredo to poke in his ninth of the season.
The game opened up after that but Ozil's goal midway through the second half ensured Arsenal escaped with the points. It was a welcome win for under-pressure Wenger but not quite the sign of a return to form. Holding, Koscielny and Gabriel failed to make a single tackle in the first 60 minutes and stronger sides than Middlesbrough will not be as forgiving.