Drain the tank, remove the sender, let the surfaces dry off thoroughly, either bake the O-ring in a toaster oven at its lowest temperature or leave it out in the sun for a while (to evaporate all the gasoline out of the rubber so it shrinks down to the correct size), and then very carefully glue the O-ring to the tank with something fuelproof. I prefer RightStuff, and it worked for me in this application.
.