Manchester United, in fifth, have three points more than the Gunners having also played 31 matches.
It's been a season of two halves for Arsenal and their beleaguered long-serving manager Arsene Wenger. The Chilean curled in a lovely free-kick from 25 yards out, giving Boro keeper Brad Guzan no chance.
Downing was presented with a half-chance to fire his side ahead five minutes later when Nacho Monreal could only help substitute George Friend's cross into his path, but he blazed high and wide from a tight angle.
The hosts were nearly ahead when Daniel Ayala's header was saved by Petr Cech but Ozil sealed the victory from close range after a lay-off from Aaron Ramsey.
Playing in an unfamiliar 3-5-2 formation, Arsenal took the lead on 42 minutes when Sanchez curled in a free-kick following a foul on Granit Xhaka by Adam Clayton.
"For us, the clarity is there - we have to win every game to have a chance to get in the top four", Wenger said, after he watched Arsenal edge to only their second league win since the start of February.
"The fans want to be behind the team and the way we respond on the football pitch will decide the attitude of the fans", Wenger said. "After he can give us the extra bit (going forward) that is important as well".
"I felt that we were recently a bit vulnerable defensively and to give a bit more reassurance to the team", Wenger told Arsenal TV. "That shows you that even in my age you can change".More news: Will US Launch Preemptive Strike Against North Korea?
"I just felt that sometimes the team needs to believe in something new, something different, just to find a bit of confidence back". We'd done it in the week and then we did it in the game.
That was to be as good as it got for the Teessiders in the first half though as they once again struggled to create much in front of goal.
"We responded well. I think it was not ideal but the commitment and focus was there".
"The gap hasn't been getting any bigger, but now we are getting to the stage where we need to win".
Middlesbrough are the only side in English league football not to have won a league game during 2017 and that terrible run of form has put them perilously close to an immediate return to the Championship. It gave the opponents more of the ball.
Agnew said: "I think that was the moment. I thought we did well tonight".
Middlesbrough, meanwhile, is battling relegation and entered the day six points away from safety, with two games in hand on 17th-place Hull City.
Boro head coach Steve Agnew praised his players and is refusing to give up on the club's top-flight status, saying: "The players were awesome in terms of their effort and commitment and attitude towards the game".