There are gyms all over the place in SJ. Ones with websites may tend to be a bit nicer, but also may be more expensive. Try searching using gimnasio rather than gym you might get more hits. They'll probably be in spanish but you should get the gist of it.
Velm posted about one place in another thread that is near Parque Central just a few blocks from the Gulch
http://www.costaricaticas.com/phpBB2/viewtopic.php?p=34000 which cost about $25/wk.
I also recall reading somewhere that you can use the Holiday Inn gym for a fee (free if you're a guest) but I don't know how much it costs or what they have for equipment (in my experience hotel gyms usually suck).
Its not as close to the Gulch but I joined the Fitness Centre at the Mall San Pedro (4th floor on the back left hand side)(506) 281-0163 because it was just a short walk from where I was going to school (if coming from the gulch its about 5 minutes and 120c by bus). Even the regular rates were a bit less expensive than the place Velm talked about 4500c/day, 9000c/wk & 15200c/mo (or 13000c/mo if you go only during non-peak hours) and the equipment was in good condition. There were no palm trees outside the window like Velm described at his place but the view of the chicas at the Mall I think made up for it.
Just to show you what else you can find if you look around. I found another place near UCR for about half that rate, but didn't like the condition of the place as much. I know there are similar inexpensive places downtown.
At the other extreme check out:
http://www.fitsimons.com/inicio.html (506) 296-0264 - In Sabana Sur about 1.5 blks east of the colegio medico. Rates there are 5500c/day, 13000c/wk & 27500c/mo.
http://www.worldgymcr.com/english.htm (506)201-8510 - In Escazu a few blocks south of the multiplaza. Rates run on a reducing scale $20/day $35/wk $50/2wks $60/3wks etc.
And if you want to work out while visiting Quepos/MA try:
http://travelblogs.com/gimnasiofitness/ (506) 777-3400 with rates as low as $2.40/day and $7.20/wk.