The top seed started strongly, claiming the first set 6-2 but the Pole hauled herself level in the match when she won the second-set tie-break 8/6.
Williams then cruised into a 4-0 lead in the deciding set, before eventually advancing after closing it out 6-4.
Third seed Johanna Konta had an easier passage into the third round with a comfortable 6-3 6-1 win over wildcard Julia Boserup.
WTA Stanford
'Humbled' Konta defeats Venus to win first Tour title
25/07/2016 AT 05:57
The Brit will face China's Saisai Zheng in the next round after she sent home the seventh-seeded Alize Cornet with a 6-4 6-1 victory.
Fifth seed Misaki Doi came through an all-Japanese clash with Nao Hibino, beating her unseeded compatriot 6-3 6-4.
Top seed Sam Stosur reached the quarter-finals of the Citi Open in Washington after former world number one Caroline Wozniacki was forced to retire.
Wozniacki won the opening set 7-5 despite receiving treatment to an injury to her left arm and she called an end to game when trailing 4-3 in the second set.

Johanna Konta reaches for a backhand against Elena Vesnina

Image credit: Reuters

Wildcard Jessica Pegula beat Christina McHale 7-5 6-2 to reach her first WTA quarter-final.
Sixth seed Yulia Putintseva overcame a second-set wobble against America's Usue Maitane Arconada to advance with a 6-4 4-6 6-4 triumph.
Seventh seed Yanina Wickmayer overcame Shuai Zhang 6-3 7-5, while in a first-round clash completed after poor weather on Tuesday, Lauren Davis beat Shelby Rogers 5-7 7-5 6-3 in an all-American clash.
At the Ericsson Open, top seed Angelique Kerber avoided an upset after battling back from a set down to beat wildcard Cornelia Lister 2-6 6-4 6-2.
Second seed Sara Errani did not have things her own way either as she was made to work hard by Viktorija Golubic before coming through 7-6 (8/6) 6-1.
Errani will face Katerina Siniakova in the third round after she dumped out fifth seed Anna Karolina Schmiedlova 6-3 4-6 6-4, while there were also wins for Laura Siegemund and Karin Knapp.
Murray reveals ranking ambition after 'frustrating' Isner defeat
Wimbledon order of play, Day 4 - When are Swiatek, Nadal and Boulter playing?