Please provide the following:
1. Computer make/model or CPU, OS and maintenance level, memory
2. Type of sound output from computer - (on-board or dedicated audio interface - if interface then model)
3. Sample rate of sound device
4. Sonar Driver Mode and Sample Rate
5. If external interface - is it connected through Fire Wire? USB?
6. If USB - are you plugged into USB 2 or USB 3 into computer, with the interface
7. If your project has effects loaded, does the problem go away if you temporarily bypass all effects, by hitting the letter 'E' on your computer keyboard? (hitting 'E' again will turn the effects back on, by the way).
We need more info than you provided - I do not know if any of the above are factors in your issues, but it is a place to start.
It is also possible your midi buffers in Sonar are too small.
Lots of folks post their computer specs in their signatures - you can look at the bottom of my post for an idea of what someone might list - it helps others in the forum understand your system at a glance when helping you - for this or for future issues you might have. To add info to your signature - click on User Control Panel, then on the Signature button, and add your info, making sure to also check the box that says:'always attach signature to post' and then save the info.
It is hopefully something simple, like increasing your midi buffers, etc.
Bob Bone