Eric Hosmer singled home the winning run on a 0-2 pitch with two outs in the ninth inning.
Chicago stayed two games ahead of Detroit, which lost in the afternoon to Oakland, with 13 games remaining. The White Sox went 6-12 against the Royals this year, including one stretch of six consecutive losses.
"We've played them tough all year," Hosmer said. "It's baseball. Certain teams match up well against other teams."
After going 1 for 12 with runners in scoring position in Wednesday's 3-0 loss to Kansas City, the White Sox went 1 for 8 in those situations and stranded seven runners. Chicago is hitting .190 with runners in scoring position over the past 19 games.
"If you keep shooting yourself in the foot it's going to come back to bite you," White Sox manager Robin Ventura said. "If you keep having opportunities and not taking advantage, a team like this will beat you."
Rios tried to score with one out in the third when Jeremy Guthrie's pitch rolled a few feet behind Perez. But Perez's toss to Guthrie cut down Rios at the plate.
"Alex thinks he can go, then he hesitates," Ventura said. "That one's an instinct play, you go or you stop. It's little things like that we have to stop doing."
Rios' out became more magnified when Kevin Youkilis singled to left two pitches later.
"If you hesitate and don't get a good read, bad stuff happens when you do that," Rios said. "You have to be aware of the situation, with one out I could have scored on a fly ball. It was a tough read, a bad angle. I hesitated. I've got to go without hesitating."
Perez nabbed Ramirez in the fourth for his fifth pickoff, most among major league catchers.
"I don't know if they've got quicksand around third, but we've been losing guys over there," Ventura said.
Chicago wasted an early 3-0 lead and lost to the sub-.500 Royals for the ninth time in their last 11 meetings.
Billy Butler led off the Royals ninth with a single against Jesse Crain (2-3). Pinch runner Jarrod Dyson stole second with two down and Jeff Francoeur was walked intentionally. Matt Thornton relieved and Hosmer singled down the third-base line.
Greg Holland (7-4) worked a scoreless ninth for the victory.
Guthrie committed a throwing error in the second that led to two unearned runs. He walked Dan Johnson and gave up an infield single to Ramirez, then made a wild throw to first on Gordon Beckham's sacrifice that allowed a run to score. Dewayne Wise added an RBI grounder.
Guthrie allowed three runs and eight hits in six innings. The right-hander is 4-0 with a 1.75 ERA in his past nine starts, all of which the Royals have won.
"I didn't have great command or great stuff, but I relied on defensive plays," he said. "Sal made three great plays. I don't think I really settled in. Really each pitch seemed like a struggle, not many at-bats did I feel like I was in control. It was a real struggle. I didn't have a feel for much of what I was doing."
"Gio's hit turned it around," Royals manager Ned Yost said. "We were doing absolutely nothing until then."
White Sox 1B Paul Konerko was held out of the lineup with a sore back. Rios replaced him in the cleanup slot. ... The White Sox continue their trip with a weekend series at Los Angeles. RHP Jake Peavy will start Friday night against the Angels. He is 0-2 with a 5.04 ERA in four career starts vs. the Angels. ... RHP Luis Mendoza, who had strep throat and was scratched from a Wednesday start, will start Friday for the Royals against Cleveland. ... Perez has picked off a franchise-record eight in 104 career games. Darrell Porter held the club record with seven in 492 Royals games from 1977-80.