Hays, Valaika, Rio Ruiz and Ramon Urias -- the Nos. 5-8 hitters -- each had three of Baltimore's 18 hits as the Orioles won for just the second time in eight games. Hays also had three hits and a homer on Wednesday night.
The Red Sox had won three in a row, with a chance to tie Baltimore for fourth place in the division had they swept the series. Instead, Boston trails by two games with three games to play in the pandemic-shortened season and has clinched its worst winning percentage since the 1965 team lost 100 games.
"I know it was not the way that we were supposed to play, but we are trying to do our best," Red Sox starter Martin Perez said. "One thing that I want to say is we're never going to quit. I know it was not the best season for us, but we still have three more games, just go home, prepare our bodies for next year. We're going to have a great season next year."
Alex Cobb (2-5) gave up one run and six hits in seven innings for his first win since July 25 -- the second game of the season. He had lost five straight decisions over eight starts.
"Coming off the surgery last year my goal was to get back to feeling normal this year," he said. "There was some ups and downs on that path, but I think I finally found it."
Perez (3-5) allowed six runs on nine hits and a walk in four innings; he struck out two.
"Sometimes you go out there you think you have your stuff, and it's not (there)," he said. "The way that I finished the season was not the way that I expected, but that's part of the game."
Infielder Tzu-Wei Lin pitched the ninth for Boston -- his first career pitching appearance -- allowing three more runs, including Hays' homer.
In the Fenway finale, the Red Sox used the center field scoreboard to thank different groups that contributed to the unusual season. Messages were posted for the technical and cleaning staffs, as well as baseball operations and even the media.
"Thank you medical team," one message read. "We made it this far because of you!"
"Thank you productions," one said. "For cheering along every play with (asterisk)(asterisk)positive reaction 2(asterisk)(asterisk)"
"Thank you players, coaches and staff," another said. "We hope you never have to spit in a tube ever again."
"Thank you to anyone we missed," the last one said. "It's probably because we have been locked inside the control room and haven't been allowed to interact with anyone for 3 months."
Baltimore scored three in the second inning when Ruiz singled in one run and scored on Cedric Mullins' two-run double. They added three more in the fourth when Ruiz led off with a double and then Urias bounced one into the right field seats; after Urias scored on a sacrifice fly, Iglesias homered to make it 6-0.
Ruiz doubled in a run and scored in the fifth to take an 8-0 lead and then made it 9-1 on Valaika's solo homer.
"Good to see some guys having some good nights in the stats line," Orioles manager Brandon Hyde said.
Red Sox fans weren't able to visit Fenway Park this season, with all major league games off-limits to fans because of the coronavirus pandemic. But residents of Boston will be able to cast their ballots in the upcoming election at the ballpark during the first weekend of early voting, Oct. 17-18.
The Boston City Elections Commission approved Fenway Park as an early voting location on Thursday. The ballpark is one of 21 early voting locations across the city.
The state voting registration deadline is Oct. 24.
"Voting is one of the best ways to support and champion the issues and policies we value," Red Sox president Sam Kennedy said. "What better way for the Red Sox to help with that effort than to open up our ballpark for Boston residents to cast their early ballots."
Red Sox reliever Domingo Tapia was hit in the right arm by a line drive back to the mound by Urias. Tapia chased the ball as it rolled toward first base, flipped it to the bag for the force out and then lay on his stomach on the grass. He left the game, having thrown just two pitches.
Orioles: Finish the season in Toronto. Pitchers TBA.
More AP baseball: https://apnews.com/MLB and https://twitter.com/AP-Sports
Ronald Acuna Jr. staying 'positive' through ACL tear recovery, embracing new role as Braves cheerleader
Outfielder Ronald Acuna Jr. can't help his Braves teammates on the field as he recovers from knee surgery, but he was on the field before Sunday's Game 2 of the NLCS, embracing his role as cheerleader and giving a rare bit of insight on his ongoing rehab.
Major League Baseball to require teams to provide housing for minor league players starting in 2022, sources say
Amid mounting pressure from players and advocacy groups, Major League Baseball will require teams to provide housing for minor league players starting in 2022, sources told ESPN.
Houston Astros' Luis Garcia will stay on ALCS roster after leaving Game 2 start with knee soreness
Astros rookie starter Luis Garcia said Sunday he's feeling better after leaving Game 2 with knee discomfort.
3B Justin Turner, nursing a neck injury, not in Los Angeles Dodgers' lineup for NLCS Game 2
Justin Turner, a Los Angeles stalwart who has played in 79 postseason games, was not in the lineup for Game 2 of the NLCS Sunday, as the Dodgers looked to even the series with the Braves in Atlanta.
Boston Red Sox to start lefty Eduardo Rodriguez in Game 3 of ALCS
The Red Sox will start lefty Eduardo Rodriguez in Game 3 of the ALCS on Monday night.
Los Angeles will look to extend series lead over Atlanta in Game 2
Atlanta Braves (88-73, first in the NL East) vs. Los Angeles Dodgers (106-56, second in the NL West)