The extension is for two years on top of the one year Foles had remaining on his rookie contract and could keep the quarterback with the Rams through the 2017 season.
Sources told ESPN that the deal is worth $24.5 million, giving Foles three years and $26 million when combined with the existing year. The 2017 season can be voided based on team wins and if he makes the Pro Bowl, a source said.
Foles and the Rams officially completed the deal just before the team's scrimmage at nearby Lindenwood University on Friday night.
"It's something the team had talked to my people about, and I want to be here," Foles said. "I want to focus on my teammates. I want to be all-in. I don't want to have to worry about contract issues or anything. To me, that can be selfish. I'm very fortunate to be here. I'm fortunate to have a contract. To me, I'm very thankful."
The Rams acquired Foles in a March trade with the Philadelphia Eagles, sending Sam Bradford to Philadelphia for Foles and draft choices. In three seasons with the Eagles, Foles threw for 6,753 yards with 46 touchdowns and 17 interceptions. He completed 61.6 percent of his passes.
In the time since St. Louis added him, Foles apparently did enough to impress his new team, and coach Jeff Fisher acknowledged in June that the Rams were interested in getting a deal done.
Before training camp started last week, general manager Les Snead echoed those sentiments and went so far as to say a deal was "definitely realistic."
Little more than a week later, it went from realistic to reality.
"It's a good deal for us, good deal for him," Fisher said. "He wants to be here, and we want him here right now. He's done a lot of good things for us in a short period of time."
Asked why the Rams were in such a hurry to get Foles signed before he played in a game, Fisher pointed to his past performance and intangibles.
"It's what he's done on the field early in his career thus far in the league and what he's done for us since he's got here," Fisher said. "He gets the game, he understands it and he's got tremendous leadership qualities. He can settle in, and now the players can rally around them and he can rally them and we'll go on and win a lot of games."
While the Rams were publicly declaring their desire to keep Foles after such a short period, he was responding in kind. He said in June that he was open to getting a deal done and said last week that he wasn't concerned if the contract talks carried into the season.
Although there was no hard-and-fast deadline to get a contract finished, the hope for both sides was that it would happen sooner than later.
And now it has.
Information from ESPN's Adam Schefter was used in this report.