The answer to this is that the remedy is the exact same thing that caused all of the trouble in the first place. As you know, all of the trouble (all of the people falling in love with the "wrong" partners) was caused by Puck. He was the one who put the potion on the eyes of various people, causing them to fall for the wrong person.
In Act III, Scene 2, Oberon tells Puck to fix all the trouble. So Puck gets Lysander and Demetrius to fall asleep and then annoints their eyes. When they wake, they see the "right" women and everything is back to how it should be.
In Act III Sc.2 we learn that Puck who was unable to differentiate between Lysander and Demetrius has mistakenly put the 'love juice' in Lysander's eyes instead of Demetrius'. Oberon orders Puck to correct his mistake by searching out Helena and to bring her in front of Demetrius, to make certain she is the one Demetrius falls in love with. Meanwhile Oberon applies the love juice to Demetrius's eyes so that he will fall in love with Helena when he wakes up.
Next, in order to cure Lysander of his mistake in falling in love with Helena Oberon orders Puck to apply the antidote to the 'love juice' into Lysander's eyes:
It is this magic antidote which nullifies the effect of the 'love juice' which sets right everything.