If you can't use your aloe vera gel right away, you can extend its life by more than just a few hours with the right tools. The first thing you'll want to do is to find a non-clear, airtight container. This can be a glass jar, plastic container, or locking baggie.
The reason for an airtight container is that it's important to limit the amount of oxygen reaching it. The moment oxygen hits the gel, it starts to decompose, according to a 2011 study in the Journal of Food Science and Technology. The less air that can get to it, the longer the product is going to keep. Typically, if you're keeping it at room temperature, you have about one to two days before you'll want to throw it away.
It's also important to make sure that you keep your aloe vera gel out of direct sunlight since the UV rays can damage the gel. The aforementioned study recommends the use of an amber glass container. If you don't have an amber storage container, you might want to consider storing the gel in a dark area where the sunlight can't reach it. However, if you need to get a little longer than a few days out of your aloe vera, you need to think a bit cooler.