A polygeneration system producing hydrogen, electricity, process steam, and heating water is modeled and studied by conducting an exergoeconomic analysis. This system includes a homogeneous charge compression ignition (HCCI) engine burning a rich methane-air mixture, a water-gas shift reactor (WGSR) and a palladium membrane for hydrogen separation. Different cost-apportioning methods were considered in the present work in order to assess their suitability for the studied system. Furthermore, a global sensitivity analysis was used to identify the relevant system parameters as well as to quantify the influence that the input data uncertainty causes on the costs of the system products. It is shown that these costs are sensitive to the investment costs of only few system components and that the highest exergy destruction rates and costs occur in the engine. With the predicted cost of hydrogen ranging from 3.23 to 3.99 (sic)/kg at EGR ratios of up to 25%, the studied process is promising.