Ugh, I can't bet the twins. I always run out of ammo/time/hp.
Here's what you gotta do:
Before night, make a 20x long bridge of Meteorite or Hellstone
Prepare yourself.
My chosen gear is hallowed armor, megashark, 1000 crystal shot, mythical rainbow rod, and a few accessories.
Perhaps use that. Ensure you do not have protection from the damage of the Meteorite or Hellstone. [A holy symbol is recommended if you dont have many potions/good armor]
Immediately summon the Twins when night arises, and target Spazmatism first while still no the Metorite or Hellstone. Once Spazmatism is dead, you will probably only have a hundred shots or so left, carefully aim and fire those, then spam your rainbow rod or any other ranged weapon you have. Continue to do this until you beat them.
Then you get loot.