It doesn't reset itself.
You seem to totally misunderstand what a check engine light is.
It is your engine calling 911 to you. There is something that immediately needs to be addressed. Sure, it might be the gas cap. It also might be a set of bad sensors, that are destroying your engine. Could be that your fuel sender is bad, which would tie in with it going away when you fill up. This is a problem, because if your fuel system shuts off, so does the car. While you're driving.
Currently, you're ignoring the 911 call. Good job. Way to be a responsible car owner.
Take it in, have the code read, and find out what is actually wrong with it.