In this research, a practical approach to estimating demand function for pricing optimization and seat inventory allocation of intercity passenger railway services was developed. Willingness-to-pay approach was used for estimating demand. Demand for the service was estimated from choice-based conjoint data using hierarchical Bayes estimation method. The proportion of customers willing to buy a certain service was estimated using market simulation. Monotonic cubic spline interpolation was used to estimate the price-response function. The size of maximum demand achievable was estimated from sales data. The approach was implemented to the largest intercity passenger train service in Indonesia. Two customer segments were assumed, i.e. business and leisure passengers, with four fare classes. Our first optimization problem sought to determine optimal capacity allocation for the existing fare classes. The second optimization problem aimed to determine optimal fare and the corresponding optimal capacity allocation for each fare class. Solution to the nonlinear pricing optimization problem was obtained using enumeration. Subsequently, the popular Expected Marginal Seat Revenue-a (EMSR-a) heuristic was used for the seat allocation inventory problem.