ESP8266 range question

I do not know exactly which libraries you are using, please let me know which one, if the function calls below do not exist in your library.

First, look at the ESP8266 data sheet for TX Power. You should see

TX Power 802.11 b: + 20dBm (that is 100mW)
TX Power 802.11 g: + 17dBm (that is 50mW)
TX Power 802.11 n: + 14dBm (that is 25mW)

RX Power 802.11 b: - 91dBm (that is 8 to the power of -10 mW) most sensitive
RX Power 802.11 g: - 75dBm (that is 3 to the power of -8 mW) second most sensitive
RX Power 802.11 n: - 72dBm (that is 6 to the power of -8 mW) least sensitive but close to 2

So 802.11b should give you the longest distance, which makes sense it has the lowest bitrate. But test all three modes to see which one is the best in your environment.

There should be a function WiFi.setPhyMode(PHY_MODE_11B).

If this is set you should be able to use the WiFi.setOutputPower(20.5); to set the maximum output power of 100mW. Be careful when you call this function when you have chosen a different phy mode. I am not sure what happens. You would need to look at the source code. It could just simply call the maximum possible, the minimum or do nothing at all.