Start by measuring oil pressure with a mechanical guage installed where the oil light switch is located. Minimum oil pressure at idle is 13psi.

If that shows to be OK, then buy a new oil pressure light sender.

AZ-Jeff
I don't own an XJ any longer, but I still think they are the best of all the Jeep products ever made. My XJ was my favorite vehicle in my 50+ years of driving.
So...I stick around and give advice.

Why does everyone think thicker oil is the answer? I've got friends that are running something like 20W-40 or something like that and wonder why they go through oil pumps every couple years.

Because they think backwards:
Low oil pressure is not necessarily bad. In fact, it can be beneficial to a engine operatiing within normal limits.
By the same token, high oil pressure is not necessarily good. It can be caused by blocked oil galleries or a too viscous (thick)lubricant.

Oil pressure is caused by the oil's resistance to flow. Therefore, wide oil clearances and low oil viscosity permit oil to flow freely.
The results would be low oil pressure and more reliable lubrication. Conversely, narrow oil clearances (either by design or
blockage) and high oil viscosity causes lower oil flow. While oil pressure would be high, lubrication would not be as efficient. A
"good" oil, therefore, has viscosity characteristics sufficient to provide good hydrodynamic lubrication and also flows freely
around the engine to maintain a continuous supply of lubricant.