What can I do to treat a muscle strain in my leg?

Leg sprain. Non-steroidal anti-inflammatory agents, plus checkup by your pcp.
Muscle strain. Initially rest, ice, and a nsaids. Then after a few days switch to heat and gentle stretching.
Muscle strain. Anti-inflammatories are a staple of treating both muscle sprain and strain.