NEW YORK (CBSNewYork/AP) — CC Sabathia won for just the second time since the All-Star break, Didi Gregorius and Aaron Hicks hit two-run homers as the New York Yankees built a six-run lead and beat the Baltimore Orioles 10-8 Friday night to close in on their second straight AL wild card.

Luke Voit added a two-run single to give him 24 RBIs in 31 games with the Yankees, and Hicks scored four runs. After Baltimore closed to 9-8 in the eighth, Aaron Judge doubled in a run for his first RBI since returning from the disabled list on Sept. 14.

New York lowered its magic number to two over Tampa Bay for ensuring a wild-card game on Oct. 3, most likely against Oakland. The Yankees began the night 1½ games ahead of the Athletics for home-field advantage.

Baltimore dropped to a major league-worst 44-109, overtaking the 1937 St. Louis Browns for second-most losses in franchise history behind the 111 of the 1939 Browns.

Backed by a 6-0 lead, Sabathia (8-7) allowed two runs in six innings and improved to 20-11 against Baltimore. The 38-year-old left-hander, making perhaps his last Yankee Stadium appearance, struck out five and raised his total to 2,981. He had been 1-4 in his prior 11 starts.

Gregorius hit his 27th homer in the first and Hicks added his 25th in a four-run fourth off rookie Yefry Ramirez (1-7), who is 0-4 in 10 starts since beating Boston on July 24. A former Yankees farmhand, Ramirez gave up six runs, six hits and three walks in 3 2/3 innings and fell to 0-3 against New York.

LOOKING AHEAD

New York hasn’t said whether Luis Severino, Masahiro Tanaka, or J.A. Happ would start the wild-card game.

Severino got just one out in last year’s wild-card game against Minnesota, and New York overcame a three-run deficit to win 8-4. An All-Star for the second straight year, he was 14-2 at the All-Star break but lost six of his next nine decisions before beating Boston this week.

“Sevy got out of the gate extremely hot and like our team has struggled for an extended period of time here in the second half,” general manager Brian Cashman said, “but I feel like he’s getting back on line, just like I feel we might be getting back on line, too. And if we can do that at the perfect timing, then we are capable of a lot and we will be a more formidable opponent than we’ve been the last two months and more representative of what we were earlier in the year.”

BOOM!-TOWN

Hicks became the fifth Yankee with 25 or more homers, joining Giancarlo Stanton (35), Gregorius (27), Judge (26), and Miguel Andujar (25).

Gleyber Torres has 23, and New York could match the mark of six set by the 2003 Boston Red Sox.

FRONT OFFICE BACKS SANCHEZ

Gary Sanchez, slowed by a groin injury, is hitting .189 with 16 homers and 47 RBIs, down from .278, 30 homers and 90 RBIs last year, when he added three homers and eight RBIs in the postseason.

“He’s a big reason why we had the success we had last year,” Cashman said. “We’re doubling down, tripling down on Gary Sanchez because we know the ceiling that is there and the capabilities this player has on both sides of the ball.”

UP NEXT

RHP Lance Lynn (2-2, 4.47) starts Saturday for the Yankees and RHP David Hess (3-10, 5.22) for the Orioles.