The deal contains a one-year option, which could push the deal to $6 million over two years, sources said.
Farnsworth finished last season with the Atlanta Braves. The 34-year-old reliever had a 3.34 ERA in 64 innings with the Kansas City Royals and Braves last season. In 837 career innings, he is 34-55 with a 4.39 ERA and 27 saves.
Tampa Bay is rebuilding a bullpen that was one of the keys to winning the AL East last season. They've already lost Joaquin Benoit, Dan Wheeler and Randy Choate through free agency. All-Star closer Rafael Soriano and Grant Balfour are expected to sign elsewhere, too.
Information from The Associated Press was used in this report.