Rangers Guardians Baseball

Starting pitcher Lucas Giolito has agreed to a two-year contract worth $38.5 million with the Boston Red Sox. Phil Long/Associated Press

The Boston Red Sox added Lucas Giolito to their rotation on Friday, agreeing to a $38.5 million, two-year contract with the right-hander.

The 29-year-old Giolito can opt out of the deal after the 2024 season, a person familiar with the agreement told The Associated Press. If he opts out, the contract would be worth $19 million.

The person spoke to the AP on condition of anonymity because the deal had not been announced and was subject to a physical.

Giolito struggled to an 8-15 record with a 4.88 ERA this year for the Chicago White Sox, Los Angeles Angels and Cleveland Guardians.

The Southern California native allowed 41 homers, second in the major leagues and three fewer than Lance Lynn. Giolito tied for the major league lead with 33 starts. Mixing fastballs, sliders and changeups with occasional curveballs, he struck out 204 in 184 1/3 innings while walking 73, his most 2018. He got 81 of his strikeouts on fastballs, 65 on changeups and 56 on sliders.

Selected by Washington with the 16th overall pick in the 2012 amateur draft, Giolito debuted for the Nationals in June 2016 and was acquired by the White Sox that December with right-hander Dane Dunning for outfielder Adam Eaton. He was an All-Star in 2019, when he was 14-9 with a 3.41 ERA and tied for the major league lead in complete games with three and shutouts with two.

Giolito went 59-52 with a 4.20 ERA in 162 starts with the White Sox, who traded him to the Angels on July 26 with right-hander Reynaldo López for minor league left-hander Ky Bush and catcher Edgar Quero. After going 1-5 with a 6.89 ERA in six starts for Los Angeles, Giolito was claimed off waivers by Cleveland and went 1-4 with a 7.04 ERA in six starts for the Guardians.

He has a 61-62 record with a 4.43 ERA in 178 career starts and two relief appearances.