The Red Sox had a season-high 16 hits. Jackie Bradley Jr. extended his major league-best hitting streak to 16 games as Boston won its third straight. Shaw tied his career-high with five RBIs.
The Athletics lost their fourth consecutive game.
First-inning home runs by Betts and Ramirez gave the Red Sox a 3-0 lead.
Then the Red Sox followed that up with a five-run third inning to blow the game open.
Sean O'Sullivan (1-0) got the victory in his first start with the Red Sox after signing a minor league contract in December.
Oakland's Sean Manaea (0-1) had his second straight rough outing, giving up 10 hits and eight runs in 2 2-3 innings.
David Ortiz, who entered Tuesday leading Boston with a .321 average and nine home runs, had the night off.
He wasn't needed.
The Red Sox won for the fifth time in seven games and have outscored the A's 27-12 in the first two games of the series.
O'Sullivan went six innings, giving up four runs and 12 hits, while striking out three.
In his past two starts, Manaea has allowed 12 runs and 17 hits.
Boston got the scoring going early.
Betts led off the bottom of the first with his fifth homer of the season and Ramirez added a two-run shot later in the inning, his fourth of the year. Shaw added his fourth of the season in the fifth inning.
O'Sullivan was called up on Friday, taking the roster spot of Henry Owens, who was sent to Triple-A Pawtucket.
With big run support, O'Sullivan allowed seven hits through five innings, before giving up five hits and four runs in the sixth.
Athletics: IF/OF Mark Canha (back strain) and RHP Liam Hendriks (strained right triceps) are on the 15-day disabled list. The A's recalled RHP Andrew Triggs, LHP Daniel Coulombe from Triple-A Nashville and added IF Tyler Ladendorf to the active roster, which has been depleted by injuries.
Red Sox: LHP Eduardo Rodriguez (right knee) is scheduled to pitch his next rehab start for Triple-A Pawtucket on Friday. He is coming off his third rehab start on Saturday, in which he threw 93 pitches in 5 2/3 innings. Red Sox manager John Farrell said Rodriguez is making strides in both his mobility and stability on his knee. "The last hurdle for an athlete or pitcher is the mental block," Farrell said. "He's going out and he's throwing really hard pitches, so there's support (and) there's strength and he's getting back in shape at the same time."
Athletics: LHP Eric Surkamp (0-2, 5.59 ERA) will return from a stint at Triple-A Nashville for his first start for Oakland since April 24. The A's needed to shuffle their rotation after getting rained out in Baltimore on Friday and playing a doubleheader the next day.
Red Sox: RHP Rick Porcello (5-1, 2.95) is coming off his only loss of the season after the Yankees ended his 5-0 start last week in New York. In his past nine games against Oakland, he has allowed more than three earned runs only once, going 3-3 with a 3.12 ERA.