Inspired by recent applications, this article considers the problem of an on-demand service platform (e.g., Uber, Lyft, Deliveroo) that differentiates the service of customers according to their willingness to wait and to pay. Upon arrival, customers can be admitted to the system or rejected and, at any time, service providers can be allocated to admitted customers or reserved for future customers. We formulate this problem as a continuous-time Markov decision process, which is used to find the optimal policy. Exploiting properties of the value function, we first show that the optimal policy is described by state-dependent admission thresholds and a strict priority rule with respect to service provider allocation. In a numerical study, we then compare the performance of the optimal policy with simpler policies. We find that the platform, the customers, and the service providers can benefit from a policy that controls customer admission and service provider reservation. Finally, some evidence of the robustness of the policy is provided in two extensions.