This article deals with the ruin probability in a Sparre Andersen risk process with the inter-claim times being Erlang distributed in the framework of piecewise deterministic Markov process (PDMP). We construct an exponential martingale by virtue of the extended generator of the PDMP to change the measure. Some results are derived for the ruin probabilities, such as the general expressions for ruin probability, Lundberg bounds, Cramér-Lundberg approximations, and finite-horizon ruin probability.