Shouldn't be a big surprise as they have a talented squad that stacks up to the teams around them. They had a rough start to the season and getting Barça away for your first match doesn't help, but they've been quite good and largely consistent since early November. In fact six of their seven losses happened before that time and they've only lost to Madrid since and that was after going down to ten men. They've got some firepower up front and some players that can give them a different look if need be. Vela was a steal for them as I was noting before the season started. Guy is still only 24 and worth probably triple what they paid for him.
On the flip side they are IMO benefitting from a weakened Malaga. There are other sides who are probalby more at Sociedad's level, but for me Malaga should be above them in the table. Malaga followed up their Summer sales with some January sales including Monreal to Arsenal and Buonanotte who at minimum was a good option off the bench. Now while they arguably have cover for them, this is a team still in the CL now in essentially mid April who is also fighting for a CL place in the league at the same time. If they can still land 4th, even if they don't get past Dortmund Pellegrini will have done a job for them again this season.