Fans were in attendance for Roy Hodgson's final match at Selhurst Park, with the 73-year-old departing after four years in the Palace hotseat.
Christian Benteke tied the scores at 1-1 with a diving header after 62 minutes.
It is the first time since 2018 that Arsenal have won four straight league games.
They are now 59 points, three points behind sixth-placed West Ham United, heading into the last game of the season against Brighton.
Asked about Pepe after the game, Gunners boss Mikel Arteta said: "He's come a long way in terms of consistency and the games he's producing. It's in his mindset.
"He wants to look at every action, every post-match reflection we do with him. When he has the talent he has it's a really good mixture."