ST. LOUIS — When healthy, Andrew Miller has been one of baseball’s top relievers. The St. Louis Cardinals are banking on a return to form.

Miller agreed to a $25 million, two-year deal with St. Louis that includes a club option and performance bonuses that could make it worth $36 million over three seasons.

The 6-foot-7 left-hander has been dominant for much of this decade, but he went just 2-4 with a 4.24 ERA in 37 games with Cleveland last season while dealing with hamstring, knee and shoulder issues.

“One of our stated goals this off-season was to improve our bullpen,” said John Mozeliak, the Cardinals’ president of baseball operations. “Andrew Miller is one of the premier relievers in the major league, and his addition certainly strengthens our bullpen.”

Miller gets $11 million next year and $11.5 million in 2020, and the deal includes a $12 million team option for 2021 with a $2.5 million buyout, The option would become guaranteed if Miller has 110 games as a pitcher in 2019 and ’20 combined.

He can earn $500,000 annually in performance bonuses based on games pitched: $100,000 each for 40, 45, 50, 55 and 60. He would get a $1 million assignment bonus each time he is traded.

Cleveland acquired Miller in a trade during the 2016 season, and manager Terry Francona used him as a multi-inning weapon out of the bullpen. He was the MVP of the AL Championship Series that year, and Cleveland made it all the way to Game 7 of the World Series before losing to the Chicago Cubs. Miller appeared in 10 games that post-season, going 2-0 with a 1.40 ERA, 30 strikeouts and five walks.

Miller has been exclusively a reliever since 2012, and from 2014-17, he never posted an ERA higher than 2.04. That all changed this year, when Miller couldn’t prevent Cleveland’s bullpen from declining drastically. Two prominent relievers for the Indians — Miller and Cody Allen — became free agents this off-season, although the AL Central champions still have Brad Hand, who was acquired in a July trade with San Diego.

The Cardinals went 88-74 this year but missed the post-season. They already made waves this month by trading for slugger Paul Goldschmidt.

The St. Louis bullpen had plenty of issues last season. Luke Gregerson hurt his hamstring in spring training and posted a 7.11 ERA in 17 games. The Cardinals signed Greg Holland at the beginning of the season, but he too had an ERA over 7.00 when he was released at the beginning of August.

Bud Norris had 28 saves for St. Louis last season, but he is now a free agent. Lefty Brett Cecil had a 6.89 ERA in 40 appearances.

Miller began his MLB career in 2006 with Detroit after being drafted by the Tigers in the first round. He was later dealt to the Marlins in the deal that sent Miguel Cabrera to Detroit.

Since making 12 starts for Boston in 2011, Miller has been used only in relief. He was traded to Baltimore in 2014, then signed with the New York Yankees before the 2015 season. The Indians acquired him from New York in 2016.

In the past three seasons, Miller had 16 saves, 263 strikeouts and a 2.00 ERA in 171 innings.

The Cardinals designated right-hander Ryan Meisinger for assignment to make room for Miller.