It was the seventh straight win for the Rays, who began the evening three games behind Oakland for the second wild card spot in the American League.
Pena's home run gave the Rays a 2-1 lead and Ben Francisco followed that blast with a solo shot of his own. The other Tampa Bay run came in the seventh on a double by Jose Lobaton.
Alex Cobb (10-9) collected the victory, giving up a run on three hits in five innings. Fernando Rodney worked the ninth for his 45th save.
Jon Lester (9-14) did not give up a hit over the first 4 1/3 innings, but the homers he allowed in the fifth gave him the loss.
Boston concluded what has been a season-long celebration of Fenway Park's 100th anniversary. The Red Sox, however, went 34-47 at Fenway this year -- their worst home record in 47 seasons.
Celebrity Breakups and divorces of 2014 [PHOTOS]