I agree, your water needs to be tested asap. Unfortunately, as you know, the best thing you could do would be to move him to a larger tank
. Without doing that, it's hard to say if my advice will work.
But anyways, make sure you're doing water changes daily. The new water should be the same as the old water as far as temperature and pH go so make sure of that. Bettas are hardy but you don't want to stress a sick fish.
What medication did you use?
I hate to say this (since it's out of your control), but infections are caused by poor environments 99% of the time. Water too cold/too hot/fluctuating, ammonia/nitrite, not much room to swim (this also means that toxins don't get diluted), no filtration (adding some hardy live plants could help make up for this--try java ferns or java moss), etc.
If it was me and I couldn't change tanks, I'd keep up the medication (never stop treatment in the middle, always follow the directions exactly), do daily water changes, test the water, and add some live plants to help control ammonia. I'd also feed some live and/or frozen foods to keep his immune system up (bettas seem to really thrive when offered live insects/worms sometimes, like fruit flies and blackworms).