The seventh-seeded Williams has played three sets in all four matches since her return from nearly a year out of action.
The defending champion was broken once by the No. 58-ranked Halep to lose the first set on Wednesday. But she recovered her poise and won seven games in a row from 4-2 in the second set.
Williams missed three match points at 5-0 in the third but she closed out the victory with a big serve in the next game.