ST. PETERSBURG, Fla. (AP) — A throwing error on Kevin Kiermaier's bases-loaded grounder in the ninth inning helped the Tampa Bay Rays complete a four-game sweep by beating the Kansas City Royals 4-3 on Thursday night.

Jake Bauers opened the ninth by drawing a walk from Brian Flynn (4-4) and went to third on C.J. Cron's single.

After Joey Wendle grounded out and Willy Adames was intentionally walked to load the bases, Kiermaier grounded a 3-2 pitch to first baseman Ryan O'Hearn, who made a wild toss to the plate.

Sergio Romo (3-3) worked a perfect ninth as Tampa Bay improved to a season-high six games over .500 (67-61) with its fifth consecutive victory.

Kansas City, which has lost 17 of 21, fell 52 games under .500 (38-90) and was eliminated from the playoff race.

The Rays tied it at 3 when Matt Duffy scored from second on a bad throw to first by second baseman Whit Merrifield on a potential double-play grounder hit by Cron.

Tampa Bay appeared to go up 4-3 later in the seventh on Kiermaier's grounder, but the run was taken away after a replay review determined Adames made an illegal slide at second base. The call was changed to an inning-ending double play.

Alex Gordon had an RBI single in a two-run fifth against Tampa Bay starter Tyler Glasnow that put the Royals ahead 3-2.

Adames hit a run-scoring infield single against Danny Duffy during a two-run third.

Duffy, making his first start in 12 days due to a left shoulder injury, allowed two runs and six hits over five innings.

Lucas Duda drove in a run with a first-inning single and had a potential two-run extra-base hit taken away with two outs in the third on a leaping catch by Rays right fielder Carlos Gomez.

Glasnow allowed three runs, five hits and three walks in five innings. He struck out eight.

TRAINER'S ROOM

Royals: INF Adalberto Mondesi (hamstring) was out of the lineup. . RHP Ian Kennedy (left oblique) will throw a simulated game Friday. ... OF Jorge Bonifacio (lower back stiffness) missed his third straight game.

Rays: OF Tommy Pham (dislocated right ring finger) felt soreness hitting off a tee but could play this weekend.

ROAD TRIP

Former Royals George Brett, Mike Sweeney, Bret Saberhagan and Reggie Sanders will visit U.S. troops at four locations in the Middle East next month as part of a USO trip. The group will watch a Sept. 11 telecast with members of the Missouri National Guard's 35th Combat Aviation Brigade.

NUMBERS GAME

Merrifield had three hits, extending his hitting streak to 12 games. ... Rays LF Mallex Smith went 3 for 5 and has multiple hits in seven of his last eight games.

UP NEXT

Royals: RHP Brad Keller (6-5) will face Cleveland RHP Mike Clevinger (9-7) on Friday night.

Rays: Will go with a bullpen day, including LHP Jalen Beeks (2-1), against Boston RHP Hector Velazquez (7-1) on Friday night.

___

More AP MLB: https://apnews.com/tag/MLB and https://twitter.com/AP_Sports