Should we buy a direct ticket from Naples to sorrento and just get off to see Pompeii, or do we need to buy each ticket separately? Should we buy the tickets in advance for these trains or purchase them the day of the trip?
This is a commuter train, ticketed like a city bus or subway. They no longer sell Day Tickets, so you should ask at the Curcumvesuviana window downstairs in Naples for two tickets each, the second from Pompeii Scavi to Sorrento. Even if he gives you two tickets from Naples to Sorrento, that would only waste a Euro or so. Validate the ticket each time you approach the platform for a trip. Luggage check at the Pompeii ticket office.
Tim is correct. Just a typical commuter train. Jump on (with validated ticket) and stand unless a seat is available. Need two tickets. Just buy the tickets as you need them. No discount for early purchase. The train has a reputation for pickpockets but we have never had any problems on the two times we road it each way.
As someone else mentioned, the Circumvesuviana has a bit of reputation for pickpockets and scammers, but if you're vigilant you shouldn't have any problems. The train is a bit of an "old clunker" but it will get you there. I don't believe you can buy tickets in advance for the Circumvesuviana. You'll have to go downstairs from Napoli Centrali to the Napoli Garibaldi station to access the train. As someone else mentioned, don't forget to validate.
You could also have a look at the Campania Express which is more intended for tourists. This is a seasonal train service, so whether it's operating or not will depend on when your trip takes place.