Gonzalez allowed seven hits, including back-to-back home runs by Xander Bogaerts and Will Middlebrooks leading off the fourth.
Middlebrooks hit his fourth homer and singled, raising his average to .341.
Baltimore's Nick Markakis also is hitting .341. He doubled, scored a run and drove in one.
Steve Clevenger hit his second homer for the Orioles and Ryan Flaherty had two hits.
Dustin Pedroia had two hits for Boston.
Orioles: Gonzalez is expected to start the Orioles' fourth game of the season, in Detroit.
''The first inning was good and then I started struggling a little bit towards the end,'' he said. ''But made some good pitches when I needed to. It was a rough one out there. Fastball was cutting a lot. Couldn't really find it, but towards the end was better. Last two innings were better, even though I gave up a couple of home runs.''
''I'm ready, ready to go. I'm excited for spring training to end and start the season,'' he said.
Red Sox: Starting in place of Jon Lester, right-hander Allen Webster went 5 2-3 innings, giving up five runs on 11 hits. He struck out three and walked two.
''I thought he made some big pitches with men on base,'' manager John Farrell said. ''There were a number of sinkers he left on the plate that, with their aggressive approach, particularly to fastballs, he gave up obviously a high number of hits.''
''But I thought, more than anything, he maintained mound presence and composure out there and did make some pitches, particularly with men in scoring position,'' he said.
Orioles: Left-hander Johan Santana is scheduled to throw from a full mound on Thursday as he progresses from shoulder surgery last year. ... Right-hander Dylan Bundy threw from a half mound on Wednesday for the first time as comes back from Tommy John surgery last year. He had previously been throwing from flat ground.
Red Sox: Left-hander Craig Breslow is scheduled to pitch in a minor league game on Thursday. He has been delayed this spring after a heavy workload last season. This will be his second appearance in a game, both in minor league contests.
FOR THE RECORD
Orioles: Evan Meek earned the save. ... Right-handers Suk-Min Yoon and Mike Wright will pitch for the Orioles in an exhibition game at Triple-A Norfolk on Saturday.
Red Sox: To avoid facing the team he will see on opening Day, Lester pitched in a minor league game. Throwing for high Class A Salem against a Twins squad, he went six innings, giving up one run on three hits with three walks and seven strikeouts.
''It was good. Got my work in,'' Lester said. ''Better after probably the first two. It's hard to duplicate anything when you get into a stadium and you get crowd noise and all that stuff. Biggest thing is healthy, and made it through.''
Center fielder Grady Sizemore played in the second of what is expected to be three straight games for him. It will be the first time he has played on three consecutive days since July 2011. ... Left-hander Chris Capuano also pitched in a minor league game. For Single-A Greenville, he went five hitless innings, striking out 10. ... Daniel Nava played six innings in center field for Triple-A Pawtucket at the Twins' complex. The switch-hitter went 3 for 6 with a home run and three RBIs. ... The crowd of 10,147 was the largest in the three-year history of JetBlue Park.