Gayle, 25, scored 26 goals in 74 games for Palace after joining them from Peterborough for £6m in July 2013.
"Newcastle has a massive fan base and a great history so it is amazing to be here," he told the club website.
Scotland winger Ritchie, 26, featured 42 times last season as the Cherries maintained their top-flight place.
"It's an unbelievable feeling to come to a football club like this," said Ritchie.
"I loved it at Bournemouth - I had a fantastic time there and it had a huge impact on my career. But when a club like Newcastle comes calling, I couldn't pass up this opportunity."
Both fees are undisclosed, but Gayle's move - which happened on the day Newcastle's England winger Andros Townsend went in the opposite direction in a separate deal - is reported to be worth £10m, while Ritchie's signing is believed to have cost around £12m.
The attacking pair are manager Rafael Benitez's second and third signings since the club's relegation from the Premier League, following Wednesday's arrival of goalkeeper Matz Sels.
"Dwight is a great player, a proven goalscorer, and it is fantastic news that he has joined us," said the 56-year-old Spaniard.
"We have been following some wingers for a while and Matt was one of the best prospects for this team.
"He has great ability and pace, and as soon as we knew that Andros Townsend could be leaving, our priority was to finalise this deal."
Find all the latest football transfers on our dedicated page.

The 31-year-old Brazil forward, better known just by her first name, has signed a two-year contract with an option of a third.
She has recently been playing in Sweden for FC Rosengard.
Marta was part of the Brazil side which lost in the 2007 World Cup final to Germany in China.
Marta won five consecutive world player of the year titles from 2006-2010 and has finished in the top three of the voting in every year from 2004-2014.
Orlando City chief executive Alex Leitao said: "We are incredibly proud to bring Marta to Orlando, and I am personally very excited as I have been a fan of her for many years.
"Our technical team worked hard to add the best, most accomplished women's soccer player in the world to the roster."

Firefighters dealt with blazes on Friday overnight at garage forecourts in Salisbury and Durrington as well as in residential areas of Amesbury.
An aircraft was also found burnt out at Old Sarum Airfield. Police estimate the damage caused at "over £100,000".
A man, 26, from Amesbury was arrested on Saturday on suspicion of arson.
All of the "suspicious fires" took place between 01:38 GMT on Friday and 04:40 GMT on Saturday, Wiltshire Police said.
Det Con Ian Day said: "All the vehicles were unoccupied at the time of the fires and no one was injured however the damage caused is significant and is likely to run over £100,000.
"We are treating the fires as suspicious and believe that the vehicles were deliberately set alight.
"We have made an arrest but I would like to appeal for any witnesses to come forward as they may be able to assist our investigation."
Newcastle United have signed Crystal Palace striker Dwight Gayle and Bournemouth winger Matt Ritchie, both on five-year deals.
[NEXT_CONCEPT]
Five-time world player of the year Marta Vieira da Silva has joined Orlando Pride in America's National Women's Soccer League.
[NEXT_CONCEPT]
A man has been arrested following a spate of suspected arson attacks on dozens of cars and an aircraft, at nine different locations in south Wiltshire.