The Mexican striker left the Emirates in 2011 for San Sebastian but the Spanish club have now agreed a deal with the Gunners which sees him become their player - with no strings.
A statement on the Real Sociedad website read: "Real Sociedad have reached an agreement with Arsenal FC which will allow Carlos Vela to continue at the club on a permanent basis.
"The player meanwhile, has signed a contract extension which ties him to Real Sociedad for the next four seasons. The player's previous contract was due to expire in June 2016. The Mexican striker has now formally signed his new contract."
Vela has made 126 appearances for Real in official competitions, scoring 47 goals.
Vela said: "I've also said that this is my home, I'm very well in San Sebastian, which is what I told the president when he asked my about my intentions.
"We knew it wouldn't be easy, but fortunately things have turned out well and all parties are happy.
"This club, this team, have the ambition to carry on improving and I'm convinced we're going to have an exciting year. Now I'm going to enjoy the last few days of holiday with my family and then be able to prepare for the season in the best fashion."
Meanwhile, reports in Holland suggest that Sociedad are closing in on a deal for Icelandic forward Alfred Finnbogason.
Fulham were believed to be in for the prolific frontman in January, but it would now appear as though the 25-year-old will be swapping life in Holland at Heerenveen for that in Spain.