Public Domain Image, source: SOHO/ESA/NASA.
The sun does not run out of oxygen for the simple fact that it does not use oxygen to burn. The burning of the sun is not chemical combustion it is nuclear fusion. Don't think of the sun as a giant campfire. It is more like a giant hydrogen bomb.
In standard carbon combustion, carbon atoms in the fuel move up close to oxygen atoms in the air and bond together to make carbon dioxide and carbon monoxide. At the same time, hydrogen atoms in the fuel bond with oxygen atoms to make water molecules. There are often other chemical reactions occurring in a carbon-based fire, but the combustion of carbon and hydrogen atoms are the main ones. This combustion releases energy which we experience as the heat and light given off by the flame. Most of the fires that we see in everyday life are carbon combustion: campfires, oven flames, candle flames, barbecue grills, forest fires, gas furnaces, gasoline burning in engines, etc. The key to remember is that carbon combustion requires oxygen. As soon as there is no oxygen left, carbon combustion stops.