(CNN) -- Some players might not have wanted too much court time in their first match back after a layoff, but Novak Djokovic didn't appear to mind being pushed to the limits by Gael Monfils at the Rogers Cup in Toronto.
The world No. 1, who was playing for the first time since winning Wimbledon last month, was taken all the way by the Frenchman in their second-round match before eventually prevailing 6-2 6-7 (7-4) 7-6 (7-2) in two hours 41 minutes.
"In a way it was fun, of course, and entertaining to be part of this match," Djokovic said, the ATP Tour official website reported.
"I enjoyed it. I tried to take the positives from this long match, and those are obviously the fact that I stayed over two and a half hours on the court and I have not played an official hard-court match since the Miami final.
"That helps obviously to play a little bit more, to feel the court, to feel the conditions."
Djokovic has now won all 10 of his meetings with Monfils and will face another Frenchman, Jo-Wilfried Tsonga in the third round.
Tsonga will be the fresher of the two after seeing off his countryman Jeremy Chardy 7-6(8/6) 6-4 in one hour and 37 minutes.
Djokovic has a 13-5 head-to-head record against Tsonga and has won their last nine meetings, most recently in the fourth round at Wimbledon.
But he is still wary of the threat posed by the 13th seed.
"My next opponent has a very similar game, power game like Gael's," Djokovic said.
"I'm not feeling tired, I'm not exhausted, I haven't played a tournament for four weeks. I of course look forward to compete more."
Djokovic was joined in the third round by two-time Rogers Cup winner Andy Murray, who crushed Australian teenager Nick Kyrgios 6-2 6-2 in less than an hour to set up a clash with France's Richard Gasquet.
Wimbledon semifinalist Grigor Dimitrov was taken to three sets by American Donald Young before progressing to a clash with Spanish 17th seed Tommy Robredo.
Last year's losing finalist Milos Raonic kept home hopes alive by overcoming young American Jack Sock 4-6 7-6 (7-2) 7-6 (7-4) after two hours and 24 minutes.
Canada's world No. 6, who won his sixth ATP Tour title in Washington last weekend, will next play French veteran Julien Benneteau.
Fourth seed Tomas Berdych and No. 5 David Ferrer also went through, while Marin Cilic set up a meeting with Wimbledon finalist Roger Federer -- who is seeking to add to his 2004 and 2006 Rogers Cup titles.
Serena eases into third round
Meanwhile in Montreal, world No. 1 Serena Williams was in ominous form in her second-round Rogers Cup match against Sam Stosur.
The defending champion blew away the Australian in straight sets 6-0 6-2 in just under an hour to set up a meeting with Czech Lucie Safarova, who overcame Magdalena Rybarikova 6-4, 6-2.
"It feels great to be here," Williams said, speaking in French, the WTA's official website reported.
"I thought I played well tonight. She's won a Grand Slam title and she's a really good player, so it was important for me to play well.
"I love it here and I want to thank everyone for coming out tonight."
Serena's sister Venus is also safely through to the next round after beating Yulia Putintseva of Kazakhstan 6-3 6-2. She will next play Angelique Kerber, who was beaten by Serena in the Stanford final on Sunday.
Fourth seed Maria Sharapova went through to round three despite losing the first set against 27th-ranked Garbine Muguruza, and the Russian will next play another SPaniard in Carla Suarez-Navarro.
Second seed and 2012 Rogers Cup winner Petra Kvitova also progressed with a 6-3 6-2 win over Casey Dellacqua, and the two-time Wimbledon champion next plays Russia's Ekaterina Makarova.
But No. 9 seed Ana Ivanovic is out after losing 6-7 (9-7) 7-6 (9-7) 6-4 to America's Coco Vandeweghe, who earned a clash with another Serbian, former world No. 1 Jelena Jankovic.
Australian Open finalist Dominika Cibulkova was also knocked out, going down in three sets 2-6 7-6 (7-3) 6-7 (5-7) to Britain's Heather Watson, who will now play two-time grand slam winner Victoria Azarenka.