If you are hitting a note on the Tyros in time with Sonar's metronome, then it MUST be lining up.
So the auto accomp clock in the Tyros is drifting.
If the drift is constant, you could try the following:
1) Record your song as you have been doing.
2) Align the start, again as you have been doing.
3) Go to the end of the song.
4) Move the mouse over the end of the recorded Tyros track. You should see the end lines become blue.
5) Press Ctrl. and the lines should become yellow. In this state, drag the end of the recorded clip to line up with the grid.
As long as the drift is A) constant and B) not more than a bar, you should be able to fix it.