I am looking for a dataset containing all US gasoline stations with addresses, similar to what is offered by http://www.allgasstations.com/ . XML, TXT or CSV formats are best.
There are several sources you could compile information from.
City data portals that list gas station locations:
State data portals that list alternative fuel stations:
Oregon (Clear Fuel): https://data.oregon.gov/Recreation/Local-clear-Gas-stations/if4z-s7kp
Maryland (Alternative Fuels): https://data.maryland.gov/Energy-and-Environment/Public-Electric-Vehicle-Charging-Stations-and-Alte/7yut-5ayv
The Department of Energy has a dataset that lists the location of 19,000 alternative fuel stations: http://www.afdc.energy.gov/data_download
And you could do a dump from openstreetmap for locations of fuel stations that have been crowdsourced. This link should give you info on how to do that.
To elaborate on the OpenStreetMap dump idea, here are some notes. You can use overpass-turbo.eu to quickly check this idea: example query for Portland, OR, listing 477 nodes, exportable as JSON for further processing. As it is a crowd-sourced dataset, coverage may vary dramatically between regions.
If you want to execute the query for the whole US, export the Query and use the Overpass API to download the whole dump.