Top-seeded defending champion Williams routed US qualifier Coco Vandeweghe 6-3, 6-1 in 78 minutes to book a last-eight matchup with German fifth seed Angelique Kerber. (Agencies)
Sharapova rallied to defeat Belgium's Kirsten Flipkens 3-6, 6-4, 6-1 after two hours and four minutes while Kerber took six minutes longer to eliminate Russia's Ekaterina Makarova 6-4, 1-6, 6-3.
Williams smashed 17 winners to only 11 unforced errors and denied her compatriot on all six of her break-point chances to book her 13th quarter-final in 14 Miami appearances.
"It was a much tougher match than the scoreline showed," Williams said. "Coco has such an amazing serve, so every time I was returning I was like, 'Hopefully I can touch the ball.' But it was really good for me to win this match."
Williams owns a 3-1 career edge over Kerber, whose lone win came two years ago on Cincinnati hardcourts.
"Angelique is really good and moves really, really well," Williams said. "I feel better than I did in my first few matches, though, so I hope I can keep going forward."
Four-time Grand Slam champion Sharapova, a five-time Miami runner-up, is still seeking her first title at the hardcourt event.
"It's not like I didn't have my opportunities in those finals. I just didn't take them. That's why you come back and hope for another chance."
Sharapova made 10 double faults, half of them in the first set, and served no aces but improved as the match progressed and in the final set won five of 12 points off the Belgian's first serve and seven of nine off her second serves.
Next up for Sharapova will be Czech eighth seed Petra Kvitova who beat Serbian 12th seed Ana Ivanovic 3-6, 6-0, 6-0.
Top-seeded defending champion Williams routed US qualifier Coco Vandeweghe 6-3, 6-1 in 78 minutes to book a last-eight matchup with German fifth seed Angelique Kerber.