The Frenchman was able to see off the Swiss pro 6-4 6-7(5) 6-3 in the third-round match that started off poorly for Federer, who could not hold onto his opening service game.
The current world number seven failed to come back from the early blow, while Monfils demonstrated some powerful shots across the court to secure 11 winners and grabbed a one-set lead.
Federer managed to up his form in the second set, and despite losing a service game, he was able to break back and level the set on 4-4 and then take the lead.
Monfils responded by forcing the set into a tie-break, but it was Federer who edged the contest 7-5 to push the match into a third set.
Despite his comeback, Federer was unable to maintain the momentum as Monfils took an early break and executed strong shots across the court to take a 4-1 lead before wrapping it up and moving into the final eight.