The win keeps Barca in the chase for the league title with 62 points, four points behind Atletico Madrid and two ahead of Real Madrid. The game also marked Messi's 768th appearance for the Catalan squad, breaking Xavi's all-time mark.
Griezmann opened the scoring by netting against his old club in the 36th minute and Dest stretched Barca's lead shortly before halftime after latching on to a sweeping pass from Messi.
Dest struck again early in the second half before Messi controlled a sumptuous pass from Sergio Busquets and scored.
Dembele struck his side's fifth goal of the night in the 71st minute after a brilliant solo run while Sociedad's Ander Barrenetxea hit arguably the best goal of the game to give his side a rare moment of joy.
Messi, however, had the final say, finishing off a flowing team move in the 89th minute to score his 23rd league goal of the season, increasing his lead at the top of the scoring charts.
Barcelona coach Ronald Koeman has criticised his side after a number of games this season for not being clinical enough in front of goal but had no complaints after they scored six times with 10 attempts on target against Sociedad.
"It's always important for players other than Leo to score goals. That way it's much harder to defend against us," Koeman told reporters.
The victory took Barca above Real Madrid into second place in the standings on 62 points, four behind leaders Atletico Madrid with 10 games left to play.
Koeman added: "Every game from now on for us, Atletico and Real will be difficult. It's going to be very exciting until the end of the season and we just have to keep on playing as we are."
Barca used to dread facing Sociedad away from home, failing to beat them in San Sebastian for more than a decade.
"This is a difficult place to come, Barca always used to struggle here but we came flying out of the blocks," said Griezmann.
"We worked very hard, we won the ball lots of times deep in their half and reacted well every time we lost it. It was a great Barcelona performance."
Sociedad forward Alexander Isak should have given the hosts an early lead from close range but could only shoot straight at keeper Marc-Andre ter Stegen, who denied the Swede again moments before Dest doubled Barca's lead.
"This wasn't our best game and they were clearly better than us and overwhelmed us," said Sociedad forward Mikel Oyarzabal.
"They were more ruthless than us; we went into halftime feeling bad as they scored all their chances while we couldn't convert ours and the second half was very different as a result. But no-one likes to lose like that.