So not P1511, which would never show up on our Rangers, its a "drive by wire" code I believe
P1151 Lack of Upstream Heated Oxygen Sensor Switch – Sensor Indicates Lean – Bank No. 2
Drivers side of a V6 engine, bank 2
Sensor 1, upstream, closest to engine on that side
Lean, so 0 volts showing no matter what computer does to adjust fuel mix, no "switching of voltage"
Yes, replace that O2 sensor, if no change then inspect the wires and connector for that sensor
O2 sensors generate their own voltage by chemical reaction with oxygen once heated above 600degF
Low voltage, 0.1 to 0.9volt, so under 1 volt
0.1v is lean
0.9v is rich
So any issue with its 2 wires for that sensor will result in 0 volts(lean), no switching
O2s have 4 wires, 2 are for a heater so they heat up faster and stay hot, 12v and ground
Other 2 are for the sensor itself
1998 4.0l Ranger should have a red/black and orange wire for O2 sensor on that side
Orange is a reference ground, used by most of the other sensors on engine, the grey/red wire on say the TPS, IAT or ECT
You can test for 0 ohms/continuity between the Orange wire on that O2 connector and any grey/red wire on another sensor, KEY OFF
The red/black wire on the sensor runs to the computer, pin 87
You can pull the computers 104 pin connector and do same continuity test
Pulling this connector and plugging it back in also cleans the pins/slots
Because the O2s have such low voltage ANY, even minimal, corrosion on one of their connectors causes 0 VOLTS/LEAN