In recent years, product warranties (including base-warranty and extended-warranty) have become an integral part of marketing strategy for most manufacturers as well as and a key determinant of purchasing decision for most customers. It is crucial for manufacturers or dealers who offer warranty to their customers to optimize decisions regarding price of products, durations of base-warranty and extended-warranty, price of extended-warranty, etc. On the other side, manufacturers must decide on a cost-effective imperfect maintenance strategy and spare part inventory policy for their under-warranty and out-of-warranty products. In order to solve these decision-making problems, this study proposes a novel stochastic simulation-based optimization (SBO) model with the objective of maximizing the manufacturer's profit. A metaheuristic Monte-Carlo simulation algorithm integrated with a dynamic programming approach is also presented to solve the model. A case study of vacuum cleaners is provided to illustrate the developed model and its solution procedure, and the simulation results are verified with real data. Finally, a sensitivity analysis is performed in order to evaluate the impact of key parameters on the optimal solution. Our analysis shows how different planning horizons can affect warranty-related decisions for both the manufacturers and customers, providing valuable insights to corporate decision-makers.