Both have agreed deals which will see them stay at St. James' Park until the summer of 2023.
England international midfielder Shelvey, 28, is United's top scorer in the Premier League this season and has made 130 appearances for the Magpies since joining the club from Swansea City in January 2016.
He told NUFC TV: "It feels like a home. The people here, ever since I came to the club, have made me feel so welcome. I've had some good times and some bad times here, but it's mainly good and it's just an enjoyable place to come in and work, and the city in general has been really good for me."
Ritchie, 30, signed for the Magpies in the summer of 2016 and has made 139 appearances, scoring 22 times.
"It's obviously something that I wanted," he told NUFC TV. "Since I came to the club, it's been a successful period and one that I want to continue being involved in. Hopefully I can be part of the future.
"When you sign at a club, you want to go there and make an impact and if you can be part of that club moving forward for a long time, it's something that is nice. I moved around in my younger years on loan but to come somewhere and get settled and be part of the progress of the football club is great."
Head coach Steve Bruce said: "They've been very, very good for Newcastle over the last few years and I've been lucky enough to inherit the two of them, so thankfully there's been a really good conclusion.
"They've both been here about four years now and a big make-up of the team has been those two. We all know what Ritchie's like, the way he is - there's never a dull day - and Jonjo, we all know he's a very, very talented footballer, so I'm delighted that they've committed their future."
Watch interviews with Jonjo Shelvey and Matt Ritchie on NUFC TV now