PARIS — Serena Williams looked ill, and not only because she had lost five games in a row at the French Open.

Battling a cold, Williams received a visit during a changeover from a trainer, who checked her temperature and gave her pills. Then came a third-set surge, and Williams beat 18-year-old Russian Anastasia Pavlyuchenkova today, 6-1, 1-6, 6-2.

There was no prescription to help Andy Roddick, who lost to Russian qualifier Teimuraz Gabashvili 6-4, 6-4, 6-2. Roddick threw rackets and argued with the umpire, but the fits of temper failed to produce a turnaround against an opponent ranked 114th.

The top-ranked Williams appeared in danger when she fell behind 5-love in the second set and summoned the trainer.

“I felt really dizzy out there,” she said. “Just ran out of a little energy out there, just fighting a cold and fighting sickness.”

Soon Williams’ court movement improved, her strokes steadied and she advanced to the fourth round.

“Doesn’t matter the score, especially against her,” Pavlyuchenkova said. “She’s a good fighter. She’s really confident and she is Serena.”

The seesaw victory assured Williams of retaining the No. 1 ranking after the tournament.

No. 18-seeded Shahar Peer won and plays Williams next. Other winners included Yaroslava Shvedova of Kazakhstan and wild card Jarmila Groth of Australia, who both advanced to the fourth round at a major tournament for the first time.

No. 3 Novak Djokovic, a two-time semifinalist, beat Victor Hanescu 6-3, 3-6, 6-3, 6-2. No. 9 David Ferrer lost to No. 22 Jurgen Melzer 6-4, 6-0, 7-6 (1).

Top-seeded American twins Bob and Mike Bryan were upset in the second round of doubles by unseeded Brazilians Marcelo Melo and Bruno Soares, 6-3, 7-6 (6).

On a cloudy, windy, chilly day, the center-court stadium was slow to fill for Williams’ match, the first on the schedule. Her aggressive returns had Pavlyuchenkova’s serve under constant pressure early, but the talented young Russian – a three-time Grand Slam champion in juniors – suddenly reversed the momentum in the second set.

Williams began to look sluggish during points, took her time between them and occasionally grimaced, while Pavlyuchenkova’s booming groundstrokes kept finding the corners.

The pills the trainer gave Williams provided a remedy.

“I don’t know what they were, to be honest,” she said. “I just took them. He said they can help me feel better.”

In the third set, Williams erased three break points to take the lead for good at 2-1. She again became forceful with her returns, and whacked the last one at Pavlyuchenkova’s feet for the win.

“Definitely a weird match,” Williams said. “I played all right. I definitely wasn’t at my best. I just was happy to win, especially against a player that’s on the up and up.”

Pavlyuchenkova, seeded 29th, fell to 8-1 this year in three-set matches. Williams is 100-44 in three-setters.

“After she beat me she has to win the tournament,” Pavlyuchenkova said. “I really hope so.”

Three sets were all the No. 6-seeded Roddick could manage. Playing on his worst surface, he was always on the defensive against Gabashvili, who even had the more dominating serve, with a 9-4 edge in aces. Roddick never broke and lost serve four times.

The weather and clay on Court Suzanne Lenglen — which Roddick considers particularly slow — robbed his shots of some zip.

“I got outplayed from the first ball,” he said. “It was a tough matchup for me in these conditions. He has pretty big swings and gets good length on the ball. I’m a little shorter and wasn’t able to penetrate the court quite as well. He was getting in control of the rallies most of the day.”

Roddick’s mood was sour almost from the start. During a first-set changeover, he threw two wrapped rackets because he was angry about way they had been strung.

During another changeover three games from the end, he engaged in a long, heated discussion with the umpire about the tarps behind the baseline. They were wet from rain, and balls rolling into them became heavy.

“It’s something that I’ve been pretty adamant about complaining about behind closed doors for a long time,” Roddick said. “I don’t think that’s something that needs to happen all the time.”

The 25-year-old Gabashvili, who was playing in the third round of a major event for the first time, agreed the slow conditions hindered Roddick.

“I was trying to control game always, all the match, you know, to take points in my hand and move him,” Gabashvili said. “I think he was feeling very uncomfortable.”