This is one of the most frustrating situations in the criminal justice system, and it happens more than it should.
Here is the hard reality of how plea agreements work. When a defendant pleads guilty, the deal is negotiated between the defense attorney and the prosecutor. But the judge is not a party to that negotiation and is not bound by it. The judge has final sentencing authority, and in most jurisdictions, they can accept, modify, or reject the recommended sentence entirely. That is legal, and it is one of the least understood aspects of the plea process.
The other piece that makes this so difficult is what happens the moment your son said guilty. By entering that plea, he waived his right to trial and gave up most of his appellate rights in the process. A guilty plea is extremely difficult to walk back after the fact.
That said, there are limited avenues worth exploring. If the plea agreement was a binding agreement, meaning the judge explicitly agreed on the record to be bound by its terms before your son entered his plea, and the judge then deviated from those terms, that is a stronger argument for relief. Your son's attorney needs to pull the full transcript of both the plea hearing and the sentencing hearing and compare them carefully.
There is also the question of ineffective assistance of counsel. If his attorney failed to properly advise him that the judge could deviate from the recommended sentence, that may provide grounds for a post-conviction motion depending on the state.
The first step is getting a copy of every document, the plea agreement, the court papers showing the original deal, and the sentencing transcript. Then get a second attorney to review them. The fact that the original terms are in writing is meaningful and worth having someone look at closely.