Luiz’s previous deal was due to expire at the end of this month and many thought he had played his last game for Arsenal after putting in a horror display against Manchester City last week.
Luiz appeared as a first half substitute and his error led to Manchester City’s first goal before the former Paris Saint Germain defender conceded a penalty and got sent off early in the second half.
The 33-year-old moved to North London from Chelsea last summer for a transfer fee of £8m, signing a one-year contract.
Despite Arsenal’s managerial position changing hands a number of times this season, Luiz has been fairly constant under Unai Emery, Freddie Ljungberg and Arteta, racking up 33 appearances in all competitions and scoring two goals.
Arsenal have also agreed to extend Real Madrid loanee Dani Ceballos’ deal until the end of the season.
Pablo Mari and Cedric Soares will join the club permanently at the end of the season after completing their loan spells from Flamengo and Southampton respectively.
Technical director Edu said: “I am really happy that we will have these players in our squad for the future.
"They have been part of the long-term technical plan Mikel and I have developed. They bring the right balance to our squad.
“David is a really important player for us. He has played most of our matches this season and has been important for the team.
"His passing, his communication with the team on and off the pitch. He helps everyone.