Red Sox rally to top Rangers, end four-game skid