Marcus Semien was a sophomore infielder at the University of California, Berkeley, in 2010 when Bruce Bochy was managing the San Francisco Giants to their first of three World Series titles in five years.

Two years later, Semien was visiting his girlfriend, now his wife, in Italy, and scrambling for Wi-Fi to watch as Bochy’s Giants were sweeping Detroit. By the Giants’ third World Series title of that stretch, in 2014, Semien was a young infielder with the Chicago White Sox.

“I grew up in the Bay Area, so I’d seen what he did with those rosters in San Francisco,” Semien, now the heart and soul of Bochy’s first Texas Rangers team, said over the weekend. “In the beginning of the year, nobody thought they’d do anything,” he said, speaking about those Giants teams.

Then, speaking about the current Rangers club, he said: “I knew we had talent in this room. We obviously added some big arms and bullpen help, so I knew we were going to be good. And once we brought him in,” he said, referring to Bochy, “it was just kind of like the cherry on top.”

In what so far has been a winning and exhilarating season in Texas, the cherries on top continue to arrive. On deck now is Max Scherzer, for the stretch run, after the Rangers acquired him from the Mets on Saturday ahead of Tuesday’s trading deadline. Then, on Sunday, they added the left-handed starter Jordan Montgomery in a deal with St. Louis.

Texas has led or been tied for the lead in the American League West for all but one day this season. Entering Sunday, the team had the best run differential in the American League at plus-147, which was second best in the majors, and had won 17 games this season by a total of more than eight runs. That was the most such wins by a team by the end of July since at least 1900.

The Rangers are frisky, pesky and powerful. But the Houston Astros, last year’s World Series champions, welcomed back Yordan Alvarez, a slugger, and Jose Altuve, a former most valuable player, from the injured list last week and took two of three games from Texas. Two Rangers All-Stars, shortstop Corey Seager and catcher Jonah Heim, are on the injured list. And starting pitching, a major strength for the Rangers this season, has wilted in the July heat. The rotation’s 5.12 E.R.A. this month ranked 23rd in the majors, and its 1.57 strikeout-to-walk ratio ranked last.

The foundation for success had been visible from Bochy’s home in the Nashville area last winter when Chris Young, the Rangers’ president of baseball operations, spent seven hours talking the manager out of retirement. So, too, were a few of the challenges.

“When C.Y. and I talked, I knew that they were going to go out and get some help with some starting pitching,” Bochy said. “But as I looked at the club, I knew this is a team that would put runs on the board. Like everything, you know there will be the ebbs and flows over the season, but I knew there were really good position players on this team. I didn’t know they were as good as they are. Josh Jung, for example: I looked at some video and thought, man, this is a talented kid. But what he’s doing in his first year is really impressive.”

Jung, playing a solid third base, entered Sunday’s games leading all major league rookies in doubles (23), R.B.I. (61) and hits (111). The Rangers, in fact, had 542 total bases by players who are 25 or younger, which ranked fourth in the majors behind youth-oriented teams in Kansas City, Arizona and St. Louis.

But the pitching.

The Rangers spent $244 million to boost this year’s rotation, adding Jacob deGrom, Nathan Eovaldi and Andrew Heaney. The results have been mixed, especially after deGrom was felled by a second Tommy John surgery after just six starts. Eovaldi, who is 11-3 with a 2.69 E.R.A., has been the staff leader, but a recent drop in velocity caused the Rangers to place him on the injured list on Sunday with a right forearm strain. Still, Texas starters were ranked fifth in the A.L. with a 3.88 E.R.A.

Enter Scherzer.

The last time he teamed with Mike Maddux as his pitching coach, Scherzer, a right-hander, won Cy Young Awards for the Washington Nationals in 2016 and 2017.

Scherzer is 39 now, and the numbers suggest that the three-time Cy Young Award winner is not what he once was. Nor do the Rangers expect him to be.

But they believe enough glory remains in Scherzer’s right arm to help take them back to 2016 — the year of the Rangers’ most recent postseason appearance. Especially with their high-powered lineup.

Scherzer was 9-4 with a 4.01 E.R.A. over 19 starts for the Mets this season. He surrendered 23 home runs and pitched through nagging neck and back pain, as well as an April suspension for having a foreign substance on his hand.

He has also pitched in nine of 11 postseasons since 2011, for the Tigers, Nationals, Dodgers and Mets. He knows his way around the big stage and has been a respected and well-liked staff leader in whatever clubhouse he has called home.

“It will be huge,” Will Smith, Texas’ late-inning specialist, said Saturday when Scherzer’s acquisition was imminent. “Just watching him on TV, he looks crazy out there, which I think is good. He’s got that crazy competitor look and the feel that ‘I’ve done it a long time.’ Like, nothing really is going to surprise him or scare him.”

As the Rangers worked to combat the Astros’ charge, it was Maddux, now in his second stint as the Texas pitching coach after two years in St. Louis, who was sketching out the team’s rotation for the next several days. Scherzer’s impending arrival offered a new and welcome option.

Houston, which lost two of three games against the Tampa Bay Rays over the weekend, recently trimmed Texas’ divisional lead to one game, and it remains one game, the closest the Astros have been since May 22. The Rangers were swept in a weekend series in San Diego, and the emotional lift they were hoping for after Wednesday’s testy and potentially monumental win at Houston seemed to have dissipated.

In that 13-5 comeback win, the normally mild-mannered Semien was ejected for a verbal altercation with Houston catcher Martín Maldonado a couple of innings after Semien felt Framber Valdez intentionally hit him with a pitch.

Semien, who entered Sunday leading the A.L. with 83 runs scored and ranked second in the majors with 237 consecutive games played, is Texas’ metronome. He is even-tempered, steady afield, a dependable leadoff hitter and has now played in 429 of a possible 430 games since signing with the Rangers before the 2022 season. After the emotional and wild victory on Wednesday, the Texas starter Jon Gray approached Semien in the clubhouse and told him, “You gave me chills, man.”

“Personally, I’ve had so many battles with that ball club, with the guys on that team,” said Semien, who played for Oakland from 2015 to 2020. “I was hit on purpose. Anybody who gets hit on purpose, a switch kind of flips, and I’m glad we finished that game the way we should have because it definitely woke us up. We’re in the race with those guys.

“I’ve been chasing Houston my entire career, it feels like.”

Now Scherzer joins the chase, after the acquisition of reliever Aroldis Chapman from Kansas City a month ago.

“It’s been bumpy in the bullpen,” Bochy said. “That’s been a real issue, and Mike and I have been working hard trying to get that worked out. It’s still a work in progress. Getting Chapman certainly has helped. But it’s a balanced club that plays the game right. They play the game hard and they’re playing to win, and that’s all you can ask.”

At the very least, Texas’ high-flying lineup gives the pitchers some room to work, and Scherzer will find what the others on the staff have enjoyed this summer: One or two mistakes in a game can be camouflaged by a nightly offensive barrage.

“It feels like an energy boost, like you don’t have to work to gather the energy to kind of force yourself to do something. It’s there,” Gray said. “I mean, you’re in the game, you’re still fighting. It doesn’t matter if you’re down by four right now. This is the most important run of the game. So just try and shut that down because we’re coming back.”