The Magpies have announced midfielder Shelvey, 28, and winger Ritchie, 30, will remain at St James' Park until the summer of 2023.
Shelvey 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 added: "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."