Welcome, Peter.
This is a fairly common problem for new users. It often has to do with the clock in the factory sound card, which I have to assume you are using.
Sonar defaults to WDM driver mode, and some cards don't handle it well.
Some things to try:
Increase the latency.
Change to a different driver mode (MME or WASAPI) Do not select ASIO. Built in cards do not support it.
Try increasing the MIDI Prepare buffer. The default is 250. A higher value may help.
Best option-invest in an audio interface. This will be around $200+, but will be well worth it.