Well, if it refuses to stay in gear, it shifts back down- then maybe there is a problem with your shifters. The derailleurs are spring loaded, and the cable from your shifter pulls or lets off some slack, and should not slip internally. If they do, the derailleurs, being spring loaded, will pull back and it will shift back.

Now if it is just a matter of shifting poorly, it skips about and does not stay because the chain appears to slip, that can be a worn chain and or rear cassette cogs or even the front chain rings.

Probably the first thing to do is clean the rear cassette and front chanrings, and the chain. Once clean, lube the chain lightly and then remove the extra, you don't want an oily chain.

I could go over how to adjust shifting, but that would be re-inventing the wheel. The PARK website has great info on how to do various repairs to the bike: http://www.parktool.com/. Click the lower right repair section- great info and photos. You might want to take a look at how to adjust the shifting. Great site.