It can be hard to track small leaks and malfunctions down. The best approach, if you can manage, is to get a hand vacuum pump and start testing.
First, though, makes sure that the main vacuum line that runs from engine, along right inner fender, beneath battery, to the vacuum canister behind the bumper, is good. Battery acid can eat it away, and the canister itself can crack from age or trauma.
A small leak will allow the axle to engage initially, but it will pop out under low vacuum conditions, such as climbing a hill or accelerating.
If the lines are fine, it's possible the vacuum motor itself is leaking. That's a hard call, because a new one is expensive. Shimming it into full engagement is worth thinking about then. Your only problem then will be rerigging the indicator light, since it goes on in response the the vacuum motor.
If the Vacuum motor is good, and the lines good, it could also be the vacuum switch in the transfer case. That switch, fortunately, is pretty cheap. Last I knew it was under 20 bucks.
When I had an 87, I experienced (one thing at a time) every possible failure of this system except for a broken fork in the vacuum motor. The motor leaked, the switch went bad, the lines rotted out, the rubber connectors went soft and leaked, the vacuum canister cracked, and to top it all off, at one point with all systems apparently perfect, a tiny rust hole opened up in the steel part of the vacuum lines! It was like russian roulette to take that thing out on a snowy day, and wonder if 4WD was going to stay engaged. I had it working flawlessly eventually, just about the time I replaced it.