The Epsom salt should be 100% pure magnesium sulfate. (No dyes, perfumes or additives.) You can get it at a grocery or drug store. (CVS, Walmart, etc.)
You can use Epsom salt as long as needed. Has he pooped recently? I would keep him in the Epsom salt until he pooped AND he wasn't swimming sideways.
As suggested, mix up some Epsom salt in a container of water. I, personally, would start by adding 1 teaspoon Epsom salt into 1 gallon of water. Mix well. The salt needs to be completely dissolved. Make sure the water is at the same temp as his tank water.
Can you use the old 1.5 gallon tank as a hospital tank? That would be the ideal way to treat him. You could simply put the Epsom salt water into the small tank, then acclimate him the same way you'd do a water change. (Floating his cup, then adding small amounts of water from the tank into the cup, over the course of at least 1 hour.)
If for some reason you can't use the 1.5 gal, you can float him in a plastic cup, using the tank water. You can use the cup he came in. Fill the cup about 2/3 full, then put the lid loosely on the top. (The lid should have holes in it.).
Some fish get stressed out by clear cups though. If this is the case, you can use a regular opaque plastic drinking cup. Fill it about 2/3 full, then put the plastic wrap on top. Yes, you can put some small holes into it. The purpose of the plastic wrap is to (a) add humidity to the air, and (b) keep him from jumping out.
Slowly acclimate him to the Epsom salt, just as you would during a regular water change. The process should take about an hour, as you remove water from the cup, and add small amounts of Epsom salt solution.
Do frequent water changes, using the premixed Epsom salt solution (1 tsp per gallon). If this doesn't work, you can increase the concentration of the salt. The maximum amount I've seen recommended is up to 3 tsp per gallon.