It gave Richard (7-13) a victory over an old rival. Richard's McCutcheon High School was the king of Indiana in 2003 after edging Lynn's Brownsburg High for the prep title.

"We go way back to the glory days," Richard said.

Jose Pirela had a run-scoring infield single in the first inning, and that was all the cushion Richard and relievers Craig Stammen, Kirby Yates and Hand needed. Richard got 11 groundball outs while allowing five hits and striking out five in six innings.

"I wanted to stay down," Richard said. "That is my strength to start with and I needed to kind of get back to that. My command wasn't as good as it's always been, but I felt like I was down consistently and over the plate enough to make it work."

Wil Myers added his 25th homer of the season, a two-run shot in the seventh.

After Stammen struck out two in the seventh, Greg Garcia and pinch-hitter Breyvic Valera singled, with Valera's being his first in the majors. Manuel Margot then made a running catch on pinch-hitter Tommy Pham's sinking line drive in center.

Lynn (10-7) tiptoed around trouble in the first, allowing a run on three infield hits, an error by Alex Mejia and a walk. Pirela's slow roller to third scored Margot after he opened the inning with a hit.

"Give up three hits that didn't get to the infield dirt," Lynn said. "That's just baseball sometimes, and I gave up one. But I would like to have that one back."

Lynn lasted through the sixth, giving up six hits and three walks, with three strikeouts on 118 pitches.

It was the second straight start the Cardinals failed to support Lynn. He pitched eight scoreless innings for the first time in three years but didn't prevail against the San Francisco Giants last week.

The Cardinals got a rare runner in scoring position when Paul DeJong doubled in the first. He didn't advance, though, and Richard induced double plays in the second and fourth innings. That gave Richard 27 groundball double plays, tying teammate Luis Perdomo for the most in the NL.

"He's just funky," Cardinals manager Mike Matheny said of Richard. "Guys had trouble picking him up. He had good movement. He had that cutter working the inside part really well."

TRAINER'S ROOM

Cardinals: 2B Kolten Wong (sore back) is expected to return this weekend. ... 3B Matt Carpenter (right shoulder strain) should be back in the lineup Friday.

UP NEXT

Cardinals: Luke Weaver (4-1, 2.50) faces the Pirates as St. Louis kicks off a six-game homestand. Weaver is one of five rookies to have double-digit strikeout games this season. His 90 strikeouts through his first 17 career games are the most ever by a Cardinal.

Padres: RHP Jordan Lyles (0-2, 6.71) is making his second start of the season and his first on the road. He tossed a season-high 4 1/3 innings in his Padres debut last week, getting a no-decision after allowing two runs on six hits to the Dodgers.