The former Sevilla centre-back broke through on the stroke of half-time as Barca re-established a nine-point advantage over Atletico Madrid at the summit.
Ernesto Valverde's side were once again not at their fluent best but stepped up when required – Jordi Alba netting the 64th-minute winner as an instant response to Juanmi's equaliser for Imanol Alguacil's visitors.
If Barca win at Deportivo Alaves on Tuesday and Atleti do not do likewise against Valencia a day later, they will be crowned champions with four games to play.
Lionel Messi drew an early booking from La Real midfielder Mikel Merino and rippled the top of the netting with a 27th-minute free-kick.
Barca were indebted to goalkeeper Marc-Andre ter Stegen for a fabulous stop at close quarters from Juanmi, with Willian Jose blazing the rebound over.
Ter Stegen's opposite number Geronimo Rulli got down to his right to sharply deny Luis Suarez but had no chance when Lenglet peeled into space and superbly diverted Ousmane Dembele's corner into the net.
Valverde responded to Barca's sluggish resumption by sending on Sergio Busquets for Arthur, while Messi and Arturo Vidal combined for Dembele to sidefoot narrowly wide before the hour.
But the equaliser La Real deserved arrived in the 62nd minute, with Juanmi sliding Merino's delightful throughball past Ter Stegen.
Parity was short-lived as Alba cut inside and let fly with his weaker right foot, though – the goal surviving a VAR review after Dembele was deemed not to be interfering with play in an offside position.
Ivan Rakitic could have given Barca breathing space when he clattered into the side netting 11 minutes from time, by which point Sociedad's best work was behind them.
What does it mean? Barca frailties not harming treble bid... yet
Sociedad were more than a match for their illustrious opponents, especially during a second half that is likely to have piqued the interest of Jurgen Klopp ahead of the Champions League semi-finals. Nevertheless, this Barca team seem able to locate the higher gears when required and a clean sweep of major honours remains very much on course.
Lenglet stars for unlikely set-piece specialists
Lenglet has formed a superb centre-back alliance with Gerard Pique, which came through another notable examination against La Real. It is surprising he has not cashed in before now at the other end, with the 23-year-old's excellent header Barca's 22nd goal from set-pieces this season – more than any other side in LaLiga.
Not a wonderful time for Arthur
When Barca stay above the prosaic for any prolonged period this season, the Brazilian maestro is usually pulling the strings. One delightful pass to send in Nelson Semedo early in the first half suggested this was on the cards, but Arthur failed to impose himself thereafter and made Valverde's pragmatism in sending on Busquets an easy call to make.
Barca can take another step towards the title at Alaves on Tuesday, two days before 10th-placed Sociedad host relegation-threatened Villarreal.