Random engine knock and oil pressure needle bouncing?

I have a 1999 Ford Ranger with 200K miles. Recently, on occasion when starting the truck, a knock would come from the engine (sounds like the knock is coming from the rear of the motor on the passenger's side) which would usually subside as it warmed up then go away. Had the oil changed about 1-2 months ago, there's plenty of oil, and there's no oil leak. Coincidentally or not, the knock isn't as frequent when the truck has mid-grade gas in it versus regular unleaded.

Now the other day I heard and saw the oil pressure gauge needle pinging off the stopper wildly from high to low. It appears to start bouncing when I'm at +/- 20 mph and slowing down, and then it goes crazy when I'm at idle. When I rev the engine while idling or begin to accelerate, the needle stops bouncing and rests at normal and I don't see it bouncing while driving 25 mph and faster.

My first thought was that I had a short or that it was an electrical problem. Now I'm wondering if it's the switch or sender, or even the oil pump itself. Any thoughts on what might be causing this/these issues? Any ideas or suggestions are greatly appreciated!

Low cost testing is required: first replace the oil pressure gauge sending unit and/or oil pressure light switch, to see if that corrects the crazy gauge readings? Second: change the oil and filter and try 20W50 thick oil instead of the 10W30 thinner oil that you may have been using until now. That may quieten things down for a while, however the engine knock you describe sounds like a serious bearing failure on the crankshaft. Such a failure would cause low and erratic oil pressure and would be normal after 18 years and 200k miles. If the rest of the truck is OK you should look into replacing the engine with one from a lower mileage vehicle - there should be plenty available from 1999 Rangers or Explorers in junk yards or a supplier like the one in the link. A replacement engine identical to the one that has served you well so far would be easier and lower cost than trying to rebuild the worn-out one.