Make sure you've got the latest DirectX drivers & not emulated DirectSound drivers.
You may try to put the mixing buffer length (see the Audio settings page) to a higher value. Note that you may also try to reduce it to minimize the latency. Today's soundcards can handle from 100ms down to 5ms latency, especially when using ASIO drivers. If your soundcard doesn't have native ASIO drivers, you can try the ones from www.asio4all.com.
You may also have glitches problems if the playing loop eats too much CPU or when opening or closing other windows. Windows 9x is more or less animated, & some of those animations are very bad for the timing in audio applications. To fix that problem, go to the display settings (in Windows 98), select the "Effects" tab & uncheck the "Animate windows, menus and lists" box. There are other ways to optimize Windows for audio applications, you can learn more about this on the Internet.
Once again be sure you've got the proper DirectSound or ASIO drivers accelerated for your soundcard. Also be sure no other CPU consuming or special application is running at the same time.