Serena Williams' quest for a record-equalling 24th grand slam singles title remains on course after she edged world number one Simona Halep in a dramatic fourth round clash at the Australian Open.