Tampa Bay moved within 3½ games of the AL wild card leaders, sweeping the three-game series to go a season-high 17 games over .500 at 81-64. The Rays have won 21 games in a row when scoring five runs or more.
"We needed to win these," manager Joe Maddon said. "There's no other way to look at it. Under the circumstances, you've got to do what we did or it's pretty much almost impossible to recover. Our guys believe we can do this. It's truly not impossible."
Tampa Bay was 10 games behind the New York Yankees in the wild-card standings on Aug. 7.
Boston has lost five consecutive games, its longest skid since opening the season 0-6, and nine of 11 overall. The teams play each other four more times, in a four-game series beginning Thursday night at Fenway Park.
"We're kind of in a fight right now, we know that," Red Sox manager Terry Francona said about his team's recent play. "It's not real pretty. We'll come out and fight, and hopefully play better. I always feel like we're going to play well and when we don't, we're going to fix it. I still feel that way."
Shields (15-10), who has won four consecutive starts en route to his career-best 15th win, allowed seven hits over 8 1/3 innings. Coming off a 5-1 complete-game victory over Texas last Monday, the right-hander was replaced by Dane De La Rosa after issuing a one-out walk in the ninth on his 121st pitch.
"We're back in the hunt," Shields said. "They know that we're right behind them."
The Rays went up 8-1 on Upton's 20th homer in the fifth off Matt Albers.
Upton finished with four hits and walked once. He and his brother Justin of the Arizona Diamondbacks became the first set of siblings in major league history to both have 20 homers and 20 stolen bases in the same season.
"Couldn't ask for a better day," B.J. Upton said.
Jon Lester (15-7) gave up four runs and eight hits over four innings for the Red Sox. Boston starting pitchers have gone five innings or less in nine of the last 11 games.
"I don't think there will be a letdown," Niemann said. "I think everyone knows what our goal is here. Take care of business. ... We have to win."
The Red Sox did get some encouraging news: Francona said Josh Beckett, out with a sprained right ankle, is scheduled to throw off a bullpen mound Monday.
Lester had allowed one earned run or less in his previous five starts, going 4-0 during that stretch. The left-hander threw 43 pitches in the first and 111 overall.
Rodriguez put the Rays up 4-1 with an RBI double in the third.
Marco Scutaro got the Red Sox within 3-1 on a third-inning homer. It stopped a personal stretch of 161 at-bats without a home run, dating to July 15 against Tampa Bay.
The Red Sox had two on and one out in the second, but Jason Varitek hit a double-play grounder.
Boston's Jacoby Ellsbury, who turned 28 on Sunday, extended his hitting streak to 16 games with a fifth-inning single.
Rays closer Kyle Farnsworth (right elbow) will be re-evaluated Tuesday. ... Boston RHP John Lackey (bruised left calf) is listed to make his next scheduled start on Wednesday. ... Red Sox RHP Clay Buchholz (back) threw at 60 feet on level ground and could soon be ready to throw off a bullpen mound. ... Tampa Bay purchased the contract of utility man Russ Canzler and recalled De La Rosa from Triple-A Durham. RHP Mike Ekstrom was designated for assignment. ... Boston RHP Tim Wakefield (6-6), still looking for his 200th career win, will face Toronto RHP Brandon Morrow (9-10) on Tuesday night.
MLB playoffs 2021: Will a dream Dodgers win set up another nightmare scenario for the Braves?
On the backs of unlikely heroes like Chris Taylor and Albert Pujols, the Dodgers had a dream end to their NLCS homestand. But will this series, like last year's, turn into a nightmare for the Braves?
Taylor: I don't thinking about hitting HRs, they happen by accident
Chris Taylor downplays the three home runs he hit in the Dodgers' 11-2 win over the Braves.
Taylor hits 3 HRs, Dodgers beat Braves 11-2 to extend NLCS
— For a guy who dislikes drama, Chris Taylor sure provided plenty of it.
Chris Taylor slugs 3 HRs as Dodgers stave off elimination
Chris Taylor becomes the second Dodger with 3 home runs in a postseason game, joining Enrique Hernandez.
Juan Soto faceplants while trying to play hockey
Juan Soto takes a fall while trying to show off his hockey skills.
Braves roster boosted by return of Jorge Soler from COVID list; Dodgers' Andy Burns replaces Justin Turner
The Dodgers and Braves both made changes to their rosters on Thursday, prior to the start of Game 5 of the NL Championship Series.