A trial judge always retains an overriding discretion to accept or reject the recommendations of counsel about the sentence that should be imposed. 

A trial judge is entitled to go beyond the Crown’s position on sentence if the sentence imposed is still reasonable. But when a trial judge proposes to do so, the trial judge should alert the parties and give them an opportunity to make further submissions and provide further authorities.

Ideally, the sentencing judge should give reasons for going beyond the Crown’s position.

R. v. Grant, 2016 ONCA 639, at para. 164; 
See also, R. v. Ibrahim, 2011 ONCA 611, at para. 16 [where reasons were not required].

It is an error in principle for the sentencing judge not to give the parties a chance to make further submissions prior to imposing a sentence above the Crown’s position.

R. v. Hagen, 2011 ONCA 749 (CanLII), at para. 5
R. v. Menary, 2012 ONCA 706 (CanLII), 298 O.A.C. 108, at para. 3;
R. v. Ibrahim, 2011 ONCA 611 (CanLII)
See also, R. v. Ipeelee, 2018 ONCA 13.

This error in principle entitles an appellate court to consider afresh what constitutes a fit sentence for the offender.