I don't know if this still applies, but running your tank to empty each time is not a good practice. All of the dirt and sediment settle to the bottom of your tank and get sucked up when you run it low. Replacing the fuel filter is more expensive than filling up more often. Also, the foam in the tank when you are filling it is mostly from the additives, which are usually a good thing. Fill free to correct me if I'm wrong.
I don't run mine to empty. Typically I leave a gallon or two.
I don't run any electric fuel pump systems too low but for another reason than what you stated.
The reason I never run electric in tank pumps low is because the fuel helps keep the pump cool and even though it sits in a sump, at some point the fuel will be not be surrounding the pump.
With that being said the fuel pump pickup is sitting at the lowest possible point in the tank other wise known as the sump.
The pickup has a sock on it to keep all the nasties from being sucked into the pump.
So whether your tank is full or almost empty the pump always draws fuel from the tanks lowest point.
Does that make sense?
Diesel fuel foams because it is susceptible to aeration. It is a property of the fuel. The low sulphur diesel seems to be more prone to it to me then the old diesel they use to refine.