Townsend, ranked 116 in the world, came from behind to stun the Romanian fourth seed in a third-set tie-break, winning 2-6 6-3 7-6 (4).
Halep beat Townsend 6-1 6-3 at the Miami Open in March, after which the 23-year-old asked for some tips.
Simona Halep shakes hands with Taylor Townsend
Image credit: Getty Images
Halep revealed: "After we played together, she came in the locker room and she asked me what she has to improve to be better. Next time I will not say anything."
Townsend, who will face Sorana Cirstea in round three, recalled: "I don't know why I did it, but I did it. It kind of stuck with me.
"I'm not saying that everything she said I implemented into my training, but it was definitely in the back of my head to remember what she said and also remember why I asked, what drove me to ask that question, kind of that hunger and desire to get better."