The 30-year-old Castillo will make $7.25 million in each of the next two years, and the White Sox have for $8 million for 2020 with a $500,000 buyout.

Castillo, who broke into the majors with the crosstown Cubs in 2010, hit .282 with 20 homers and 53 RBIs in 96 games with Baltimore last season. He also threw out 24 of 49 would-be base stealers for a major league-best 49 percent success rate.

"Adding Welington benefits us both in the short and long term," general manager Rick Hahn said in a statement. "He has been one of the more productive catchers over the last several seasons, and we believe his presence will have a lasting positive effect on our younger pitchers and catchers as they continue their development at the major league level."

Castillo played for White Sox manager Rick Renteria when he skippered the Cubs in 2014.

The 30-year-old Farquhar went 4-2 with a 4.20 ERA in 52 appearances last season with Tampa Bay and the White Sox. Major league teams had a Friday deadline to offer contracts to unsigned players on their 40-man rosters.