I think anything below $30mm/yr is a non-starter in having X avoid going to FA.
EDIT: As to years, 3 is not enough, 4 may be the minimum (essentially, we're ignoring the opt-out and raising X's comp from $20mm-$30mm) but 5-6 sounds about right. Note that I am not advocating for this, just what I think it will take. Personally, I'd trade him now if the package is greater than the comp pick value.
I don't know about $30m per year, but I had earlier posted what I thought his absolute floor/minimum would be, based on 1) his current contract, and 2) the idea he'd actually opt out.
His current contract is for age 30, 31, 32, with a vesting option for 33. It's $20m per year, with the last year triggered by 535 PA during his age 32 season. Maybe 120(?) games to trigger. He probably thinks he's good for the vesting. So maybe we reasonably read his view of his current deal as essentially 4 years, $80m.
He will only opt out if he thinks he can improve on that. Minimum improvement: 5 years (age 30-35 seasons) for at least $20m per, for $100m total.
So, assuming he's serious about opting out, we can reasonably guess he's not going to entertain any offer from the Sox for less than that. He'll expect to get at least that as a FA (which is why he's opting out in the first place.)
But what what does he think he's really worth on the FA market? That's more nuanced and has to consider the teams willing to make offers, other FA SS, etc. But for back-of-the-envelope purposes, how about a rough comp of Trevor Story? 6 years, age 29-34, $140 guaranteed, team option for age 35 at $20 more than the $5m buyout. . .total $155m with option. Call it an AAV of $23 or $24m.
So (and this part is total spitballing) if Xander thinks he's a Trevor Story comp, he might seriously consider forgoing FA by signing for a guaranteed 5 years/$117 on the low end? 6/$144 for a mid-range? Something with a $25 AAV for a 5/6/7 year spread of $125/150/175?
I don't know if the Sox should go long at top dollar though - Devers, Story, Xander, Mayer (2025?). Moving parts.