Petchburi is on the main rail and road routes to the south, so it's relatively easy to get to.
The trip by road takes about two to two-and-a-half hours, depending on traffic. You can take a bus from Bangkok's Southern Bus Terminal, although it can be more convenient to hop a van service near Victory Monument. There is one large van operator just under the Skytrain station that offers fast service direct to Petchburi for 100 Baht (2.60 USD).
Petchburi Train Station
The train is another way to get to Petchburi. The train station is just north of the center of town. The journey takes about three to four hours depending on the service. All Southern Line trains stop in Petchburi, although the best option is probably the Number 43 train leaving at 8:05 am. This is a 'special' all second-class (air-conditioned) train. The fare for this train is about 360 Baht (9.35 USD). The 'ordinary' train to Hua Hin leaving at 9:20 is a cheaper option. See the State Railway for a current time schedule and fares.