HiCustomer Thank you for asking your question on Just Answer.
-What year is your Ranger and what size motor?
Have you had a code scan done when the check engine light comes on and do you know the code its setting?
Well it would help to know the actual code that its setting as loss of power can be caused by many things. Low fuel pressure, a dirty fuel filter, bad MAF sensor , restricted exhaust. A stretched timing belt . I would start with checking fuel pressure (32 to 35 PSI) and then Make sure its not a skipped timing belt by following theses steps.
Check timing belt alignment. Remove the plastic plug on the front of the timing cover. Check to verify that the camshaft timing gear alignment XXXXX XXXXXnes up with the indicator when the engine is at Top Dead Center (TDC) for #1 cylinder on a compression stroke. Replace the timing belt as necessary. If the timing belt alignment is OK, disconnect the intake side ignition coil packs primary connector and test drive the vehicle to determine if the engine runs worse or better. With the engine idling, reconnect the intake side coil pack and disconnect the exhaust side coil packs primary connector to see if it runs better or worse on the intake side coil pack. If the engine runs significantly better on one coil pack than the other, replace the defective coil pack. If the engine does not appear to run any different on one coil pack vs. the other, cut the Light Blue/Red (LB/R) wire at the MAF sensor connection and connect a Digital Volt Ohmmeter (DVOM) to the sensor side of the cut wire to monitor output voltage of the sensor when driving.A typical idle voltage of the MAF sensor will indicate 0.7-1.0 volt. When snap accelerating the throttle, the MAF should be capable of producing over 3.0 volts.If the output of the replacement MAF sensor is low but there is nothing causing an engine airflow problem such as a timing belt alignment or exhaust restriction issue, replace the replacement MAF sensor and recheck conditions.