NodeMCU with two MQ gas sensors requiring multiple analog pins
Well, your title is totally misleading! I'm only saying it for you, since you will probably not attract much attention.

But anyway, if you want to switch 5V with a 3.3V level I/O from the MCU I would do it like in the circuit below.







simulate this circuit &ndash; Schematic created using CircuitLab

You have a P-MOSFET (M1) as the main switching device to turn on/off the 5V coming from your voltage source. Then to be able to turn M1 properly you have to add the M2 N-MOSFET.

When the I/O is at LOW level, M2 is off and thus the gate of M1 is pulled high through R1. Thus M1 is off and the sensor doesn't have supply.

When the I/O is at HIGH level, M2 is on and thus the gate of M1 is at a voltage close to ground. M1 is then on and the sensor is supplied with 5V minus the voltage drop across M1.

That would do the job you need.

But have in mind that the A/D converter of the MCU can only measure voltages until 3V. If you expect the analog output of the sensors to be above this voltage, then you have to properly adapt it before connecting it to the A/D pin.