I have a bike that I use for getting from place to place. The only problem is, the chain periodically slips off the gears and gets stuck between the frame and the rear wheel gears. Almost like my bike thinks there's one more gear there. It's pretty scary when it happens in an intersection because it locks my pedals. Any advice on how to fix it?
What is likely happening (which David and Daniel describe the fix to) is that your rear derailleur has become maladjusted and is moving the chain further outboard--and off the sprocket cluster--than is necessary for your particular cassette or freewheel. In a sense it does "think" there is one more gear since the current adjustment is allowing the derailleur cage more movement outboard than is necessary and the chain derails into the space between the small, high gear cog and the frame dropout.
The fix is relatively simple and straightforward. One has to "limit" the movement of rear derailleur's cage so that it can only move out as far as the last, high gear cog and no further. The two limit setting screws are paired together and typically can be found at the back/rearward end of the rear derailleur. Almost always, regardless of brand or model of derailleur, the manufacturer has designated each screw with an "H"--for high gear, small cogs or "L"---for the low gear, large cog side. The ends of these screws act on different aspects of the derailleur's parallelogram causing the derailleur cage to move in or out a few millimeters so that the upper jockey wheel gets in good alignment with the small cog at the outside and the large cog that's furthest inboard. The end-setting of these screws will ideally find your jockey wheel running straight down from the outside edge of the small cog and straight down from the center of the large cog. These two positions define the limits, high and low respectively, of the rear derailleur.
It's a good idea to release all cable tension from the rear derailleur by loosening the cable pinch bolt and allow the cable to go completely slack. This takes cable tension out of the equation as this can generate a false high limit if the cable prevents full range of outboard movement the derailleur spring can cause the cage. With the chain on the largest chainwheel and smallest cog (the highest gear), manipulate the H-limit screw so that the upper, jockey wheel of the derailleur cage comes in line with plane of the outer edge of the small cog. Turning the H-limit screw clockwise will move the jockey wheel more inboard (which based on your derailling problem is the direction you'll need to go). Counter clockwise rotation of the limit screw allows more outward movement of the cage. Again, the H limit setting should be where the middle of the jockey wheel falls in line with the outside edge of the small cog. You can now re-tension the cable and secure with the pinch bolt.
Next is low limit adjustment with the chain in lowest gear (small chainwheel, largest cog in back). Turn the L limit screw such that the jockey wheel comes in line with the center of the large cog. Clockwise movement of the L screw moves the derailleur cage to the right, counter clockwise will cause the cage to move left. When you have reached the desired limit on this low end, push the shifter as if to shift to a bigger cog to make sure any movement caused by this overshift doesn't bring the cage too close to the spokes. When these steps are completed, the limit screws are set and no further manipulation of the screws should be attempted. Indexing of the gears and and other shifting issues should be handled with the barrel adjusters.