Melee stop /follow'ing the moment they start autoattacking.

Therefore if you position the tank on the opposite side of the boss from the healer, then the melee will start /follow'ing the tank after the aoe and stop /following once they reach autoattack range of the boss.

That's the idea, anyway.