Gas gauge on 2005 Impala

About 90% of the time, my gas gauge on my 2005 Impala works just fine. However, sometimes on hot afternoons it has problems & it doesn’t read accurately. For example, I will have a nearly full tank & the gauge will show 1/4 to 1/2 full, depending on its “mood”. If I drive the car somewhere & turn it off, everything is fine after I re-start it. I have to drive it somewhere though. If I start it, turn it off right away, and re-start it, it still reads inaccurately. Any thoughts on what might be causing this?

The car runs fine & there no warning lights are lit on the dash.

Add a bottle of Techron as a first step. That helps a lot of fuel guage problems caused by sulfer.
Techron as a brand name makes a generic injector cleaner too, so be sure to get true Techron. The bottle says ''Techron concetrate plus / fuel system cleaner / exclusive sythetic formula.

I once drove to Albuquerque, 140 miles one way, with 200 miles to empty diplayed on the messege center and fuel gauge needle.
When I got there the needle and messege said 180 miles to empty !
OK, since when does an Expedition get such great mpg ??
Stopped at Auto Zone and picked up some Techron then went to fill up,
problem cured.

That’s not to say you don’t have a true sender problem, but just as a first step.