Michael Pineda watched from the sidelines late last season as his Twins teammates celebrated an American League Central title and played in the Division Series without him.

The 30-year old pitcher had been hit Sept. 8 with a 60-day suspension for using a banned diuretic.

In fact, the closest he got to the party was when teammate Marwin Gonzalez FaceTimed him from the visitors’ clubhouse in Detroit the night they clinched.

Despite that blow to the team, and despite that he still has 39 games remaining on his 60-day suspension, the Twins agreed to re-sign the free agent righthander to a two-year deal worth $20 million.

A major league source confirmed the signing, pending a physical exam.

Toronto was among teams that showed interest in Pineda, who was 11-5 with a 4.01 ERA in his first season since having Tommy John surgery in 2017. But Pineda wanted to return to the Twins and help them repeat as division champions.

The Twins’ returning starters, besides Pineda, are All-Star righthanders Jose Berrios and Jake Odorizzi. Their goal heading into the offseason was to augment the rotation with impact pitchers, but that has not happened.

The Twins, multiple sources confirmed, offered free agent righthander Zack Wheeler a five-year deal worth $100 million, but he decided Wednesday to join the Phillies for five years and $118 million. The Twins have since turned their attention to lefthander Madison Bumgarner, who could also receive nine-figure offers as well.

Their options are slim after that, as they are not expected to be in the running for either righthander Gerrit Cole or Stephen Strasburg, who could land deals in the $250 million-$300 million range.

The Twins signed Pineda to a two-year contract before the 2018 season, which he missed while recovering from elbow surgery and a subsequent knee injury, but he emerged as one of their best starters in 2019.

Pineda, who is 6-6 and weighed more than 300 pounds, apologized three days after his suspension. Major League Baseball believed his explanation that he was trying to lose weight and got the drug from a friend, and the 80-game suspension was reduced to 60.

The diuretic, hydrochlorothiazide, is banned because it can be used to mask performance-enhancing drugs.

Pineda forfeited roughly $984,000 of his $8 million salary for sitting out the final 23 days (and 21 games) of the regular season. He was also four innings shy of reaching 150 innings for the season — a benchmark that would have come with a $500,000 bonus, plus another half-million for every 10 additional innings.

“It’s embarrassing. I feel obviously sad,” he said on Sept. 11, “because I let myself down, my family, my teammates, especially where we are in the season.”

He can participate in spring training and during regular-season games, he can come to the park and work out, but he is not allowed on the field once gates open to the public. He can use the weight room and clubhouse, but he cannot be in uniform or in the dugout once the game begins.

Pineda will earn $10 million in each of the two seasons of his deal, which is $53,763 per day, based on the 186-day major league season. Over 39 games, that’s about $2,096,774 in salary the Twins won’t have to pay Pineda in 2020.