As the sharing economy develops in sustainable transportation, car-sharing platforms improve the allocation efficiency of idle cars to customers. However, as the travel demand increases, and the vehicle type becomes various, the sharing market faces a new challenge to satisfy the customers’ diverse needs for quality-differentiated cars. Each customer would like to choose the right car type, while the manufacturing firm and the e-commerce platform should set the right car price for profit maximization. How to match the platform’s product line with the customer’s choice behavior becomes a problem for all the stakeholders in the sharing economy. From the perspective of customer heterogeneity, we establish a game-theoretic framework to study product line optimization in business-to-consumer (B2C) and consumer-to-consumer (C2C) sharing. We solve the optimal quality decision and the optimal pricing strategy for the manufacturing firm and the e-commerce platform in the sharing economy. In numerical experiments, we investigate how the sensitivity of the quality and the cost can jointly influence the profits of sustainable transportation. Our findings show that within the product line, the firm’s selling profit in the C2C sharing is negatively influenced by the sharer’s valuation, while the platform’s sharing profit in the B2C sharing is independent of either buyer’s valuation. We give some policy implications for scholars, practitioners, and policymakers in the sharing economy and point out some limitations and recommendations for the product line design.