With two games at home and Sonny Gray on the mound, the Twins' route to the AL Championship Series seemed sunny and bright.

Now? Everywhere they look, there are shadows.

Shadows made Cristian Javier's slider difficult to detect, the Twins said Tuesday, though the Astros had far less trouble picking up Gray's pitches in the midafternoon sunlight. Suddenly, a team that came home dreaming of the World Series is one loss away from elimination after absorbing a 9-1 drubbing at Target Field, their most lopsided playoff loss in 21 years.

Game 4 in the best-of-five is Wednesday at 6:07 p.m. The Twins, trailing 2 games to 1, will start Joe Ryan against Astros righthander José Urquidy.

"It's baseball — it can go any way. You never know," shrugged Max Kepler, whose first-inning double was one of only three Twins hits all afternoon. "Sometimes great things happen, sometimes it doesn't go our way."

Plenty of great things happened for the Astros.

José Abreu crushed a pair of upper-deck home runs, Yordan Alvarez continued his destruction of Twins' pitching with three more extra-base hits, and Javier extended his streak of scoreless postseason innings to 16 straight.

But the most unexpected factor in the Twins' second loss in the best-of-five AL Division Series was Gray's least-effective outing since mid-July. The veteran righthander, making what could turn out to be his final start as a Twin, was uncharacteristically hittable, giving up four runs in the first inning and five overall to pitch the Twins to the brink of elimination. He gave up two home runs for the first time in a Twins uniform, and allowed the Astros' first hitter to reach base in five straight innings — each of them after facing an 0-2 count.

"They came out hot, and they came out with a big hit in the first," said Gray, whose five runs allowed Tuesday were more than he gave up in his final four regular-season starts combined. "Before you know, it was 4-0, and that was big."

It was, because Gray hardly looked like the Cy Young contender that he's been all season. Four of the first five Astros he faced reached base, two on singles plus Alvarez's hot smash that glanced off Alex Kirilloff's glove for an error.

"That play is kind of on me. It's a play that needs to be made. It just changes the complexion of the game," Kirilloff said. "Making that play, [turning it into] a double-play ball to get out of the inning, it [would have been] 0-0 and we're coming up. It's a different game."

Instead, Kyle Tucker followed with an opposite-field single to score a run, bringing up Abreu with two runners on base. Gray tried three fastballs but fell behind 2-1, then left an 84-mph slider knee high and in the middle of the plate. The pitch wound up 442 feet away, three rows deep in the upper deck in left.

"In all honesty, over the course of that first inning, I thought I made quality pitches," Gray said, with one major exception. "I wanted to get that [to Abreu] slider down and away, and it kind of spun into the middle and he hit a homer."

Gray managed to work out of trouble in the next three innings, but in the fifth, Gray left another mid-80s sweeper in the middle, this time to Alex Bregman. "Pretty much the same pitch that Abreu hit, a very, very similar pitch," Gray said, and it had the same fate, landing in the left-field seats, albeit about 90 feet shorter.

That marked the first time in Gray's 58-start career as a Twin that the righthander had allowed two home runs in the same game.

Javier, meanwhile, set a new major league record Tuesday by making his third consecutive postseason start of five or more innings with one or zero hits allowed, including the Astros' combined no-hitter against the Phillies in the World Series last October.

Javier created jam after jam for himself, walking five Twins and hitting another, but always managed to dig himself out of trouble. Five of his nine strikeouts, for instance, came with a Twin standing on second base, allowing him to strand seven runners in just five innings.

"We had plenty of opportunity. We just didn't make it happen," Twins manager Rocco Baldelli said. "Javier just kind of buckled down, got his pitches where he wanted them."

And Twins pitchers mostly didn't. Gray was relieved by a pair of starting pitchers, Kenta Maeda and Bailey Ober, and neither had much better luck against a Houston lineup that has few soft spots. Maeda gave up a walk and a pair of singles in the sixth inning, including Bregman's second RBI hit.

Ober surrendered two homers, too, one to Alvarez — who also doubled twice, giving him six hits, all of them for extra bases, in 12 at-bats during the series — and another 440-footer to Abreu.

The carnage left the Twins needing back-to-back victories to advance to their first AL Championship Series since 2002.

"When you go into an elimination game, you've got to be ready to do whatever is necessary to help the team win," Carlos Correa said. "We've got to do a better job with people on base if we want to stay alive."