The Russian, in her first appearance at a major since she returned from a 15-month doping ban in April, did not have the same inspiration that helped her beat world number two Simona Halep in the opening round but her willpower was enough.
Sharapova, who was granted a wildcard entry to the tournament, made too many unforced errors in a scrappy first set that featured six breaks of serve.
Once she found her groove midway through the second set, however, the 30-year-old, sporting a pale peach pink crystal-encrusted dress, was too strong for Babos, who bowed out on the second match point when she sailed a backhand long, triggering a huge roar on Arthur Ashe Stadium.