Gerard Butler -- Out of Rehab, Back on the Party Scene

Butler spent three weeks in treatment after realizing he was relying too heavily on prescription medication.

TMZ broke the story ... Butler began using pain meds to deal with the pain caused by the intense physical training regimen to get in shape for "300" ... and the problem became exacerbated after he injured himself in a surfing accident while filming "Of Men and Mavericks" back in December.