The seventh-seeded Sharapova lost the first set for the third straight match Thursday, but again managed to turn things around. Sharapova won eight of the last 10 games, and has now won 19 straight three-set matches on clay.
Sharapova completed a career Grand Slam by winning the title at Roland Garros in 2012, but lost to Serena Williams in last year's final.
Bouchard, a 20-year-old Canadian seeded 18th at Roland Garros, was playing at the French Open for the only second time. Last year, she lost to Sharapova in the second round.
Sharapova struggled a bit with her serve, double-faulting nine times and getting broken four times. But she made up for her shaky serving with solid groundstrokes, either going for winners or waiting out errors from Bouchard.
Bouchard took the early lead with her first break in the third game of the match, smacking a forehand winner to give herself a 2-1 edge. She quickly made it 3-1 by completing a run of winning 12 of 17 points.
The pair traded breaks early in the second set, and then again later. But Sharapova managed to stay ahead and broke Bouchard for the third time in the set to even the match at one set apiece.
Sharapova served first in the third set, and made her move in the fourth game, converting her third break point to take a 3-1 lead that she held onto until the end.
Bouchard, who reached the Australian Open semifinals in January, saved four match points before Sharapova won it with a forehand that Bouchard missed on the other end.
Sharapova won her first Grand Slam title 10 years ago at Wimbledon. She followed that with major titles at the U.S. Open in 2006 and the Australian Open in 2008. But since she recovered from having right shoulder surgery in 2008, she has vastly improved her clay-court game and has won six of her last eight titles on the red surface.
This year, Sharapova has already won clay-court titles in Stuttgart and Rome, and her six wins so far at Roland Garros give her an 18-1 record on the dirt this season.
And like against Bouchard, it's been tough to beat her in three sets on the surface. The last time Sharapova lost a three-set match on clay was at Roland Garros in 2010, when Justine Henin beat her in the third round.
Information from The Associated Press was used in this report.