Rangers probed early on and could have taken a second minute lead as Jake Charles’ header from a free-kick was saved.
However, it was the visitors who took a 14th minute after Evan Horwood squared for Kieran Weledji who slotted home.
Boro were behind for just two minutes when Alex-Ray Harvey’s fine finish from outside the box nestled into the top corner.
Rangers then almost took the lead when a long Lewis King kick was latched onto by Bradley Grayson who saw his volley saved.
Into the second half Rangers were again probing to take the lead and Jack Sherratt saw an effort cleared off the line before Grayson’s long-range effort flew over.
The winner eventually came four minutes from time with Charles’ header this time finding the net from close range.