French winger Antoine Griezmann scored twice and set up a third goal for Imanol Agirretxe as Sociedad gained a measure of revenge over the north-coast rivals who had helped condemn them to the drop in 2007.
Racing, who celebrate their centenary next year, have failed to register a victory in 17 matches. They have 26 points and are 12 from safety with three games left.
"It's understandable that everyone is emotionally destroyed," Racing's third coach of the campaign Alvaro Cervera told reporters.
"Now we have to do our best to represent an institution that has been around for 99 years and that deserves our maximum respect [in the remaining games]."
Racing have spent the last decade in Spain's top division but were left in disarray after a takeover by Indian businessman Ahsan Ali Syed turned sour last year.
The club said Ali Syed, who had promised to put Racing on the international map, failed to honour his commitments and they went into administration in July with debts of more than 30 million euros.
Elsewhere on Saturday, Sporting Gijon boosted their survival chances with a 3-0 victory at Espanyol that moved them above Real Zaragoza to third from bottom on 34 points, four short of next best Villarreal.
Villarreal were held 1-1 at the Madrigal by Osasuna after Raul Garcia struck a spectacular volley for the visitors in the 72nd minute.
At the other end of the table, surprise packages Levante were led to victory by Arouna Kone who opened the scoring in their 3-1 home win over Granada. It was the Ivorian's 15th league goal of the season.
Levante, bidding to secure a first venture into European competition next season, climbed into the last Champions League qualification berth in fourth spot with 52 points but the teams around them have a game in hand.
In Saturday's other match, Real Mallorca were 3-1 winners in a mid-table affair at Getafe.
Get the best features, fun and footballing frolics straight to your inbox every week.
Thank you for signing up to Four Four Two. You will receive a verification email shortly.
There was a problem. Please refresh the page and try again.