Yankees pitcher Masahiro Tanaka reacts during Game 5 of the...

Yankees pitcher Masahiro Tanaka  reacts during Game 5 of the ALCS against  the Astros  at Yankee Stadium on Oct. 18, 2017. Credit: Jim McIsaac

Masahiro Tanaka decided to opt in.

The righthander, a mainstay of the Yankees’ rotation the last four years, announced Friday night that he has chosen not to exercise an opt-out clause in the seven-year, $155-million contract he signed before the 2014 season.

“I have decided to stay with the Yankees for the next three seasons,” Tanaka, 29, said in a statement. “It was a simple decision for me as I have truly enjoyed the past four years playing for this organization and for the wonderful fans of New York. I’m excited to continue to be a part of this team, and I’m committed to our goal of bringing a World Series Championship back to the Steinbrenner family, the Yankees organization, and the great fans of New York.”

Tanaka had until 11:59 p.m. Saturday to make his decision. The prevailing opinion in the industry was that he would stay put rather than opt out and leave about $67 million on the table to explore free agency.

There was always the chance that he could get more than that on the market, but his erratic 2017 — a season in which he went 13-12 with a 4.74 ERA in the regular season and allowed a career-high 35 home runs — plus lingering questions about the slight tear he suffered in his ulnar collateral ligament in July 2014 made that a question mark.

Tanaka, who is 52-28 with a 3.56 ERA in four years, finished the season on a high note. After striking out 15 in seven shutout innings in his final regular-season start, he went 2-1 with a 0.90 ERA in three postseason starts. In two of the outings, Game 3 of the ALDS against the Indians and Game 5 of the ALCS against the Astros, he produced seven shutout innings. In those final four 2017 starts, he allowed two runs, 13 hits and three walks in 27 innings, striking out 33.

Tanaka’s decision helps to solidify a 2018 rotation that is likely to include Luis Severino, Sonny Gray and Jordan Montgomery, a rookie this past season who surprised many by winning a rotation spot late in spring training and sticking pretty much all season.

CC Sabathia, 37, is a free agent but has said his desire is to remain with the Yankees. That seems a strong possibility. Chad Green, a revelation as a reliever this season, will come to spring training as a starter, and prospects Chance Adams and Justus Sheffield also will be in that mix.

If Japanese hitting and pitching star Shohei Otani is posted this offseason, which is not considered a sure thing, the Yankees will be among the teams making a strong push to sign him.

More Yankees headlines