check engine light keeps coming on and going off on 2000 Chevrolet S10

My check engine light keeps coming on and going off.Sometimes I reopen my gas tank and that takes care of it for a while, then it goes back on. Please help any ideas?

Asked by for the 2000 Chevrolet S10
connect an engine analyzer to decipher code. Mine does the same but instead of gas cap answer. It usually goes on when idle. And off when on the highway which the computer said was running too lean, and too rich once. I believe it's prob. due to catalytic o2 sensor. So you might check there
3 more answers
If you have disconeected the battery to reset the codes and the light comes back on, you need to have the code read. Any of the national auto parts stores will be able to hook up and let you know what code is coming in. It does sound like an O2 sensor issue but the code will tell you for sure.
Try disconnecting the battery and after reconnecting computer should reset and the check engine light should go off.
thanks for the suggestions. It was the o2 sensor plus a leak on the flex hose part of the exhaust pipe. Repaired and no longer an issue. Unfortunatly didn't help on mpg too much