Cloud computing delivers value to users by facilitating their access to servers at any time period needed. An approach is to provide both on-demand and spot services on shared servers. The former allows users to access servers on demand at a fixed price and users occupy different time periods on servers. The latter allows users to bid for the remaining unoccupied time periods via dynamic pricing; however, without appropriate design, such time periods may be arbitrarily short since on-demand users arrive randomly. This is also the current service model adopted by Amazon Elastic Cloud Compute. In this article, we provide the first integral framework for sharing time on servers between on-demand and spot services while optimally pricing spot service. It guarantees that on-demand users can get served quickly while spot users can stably use servers for a properly long period once accepted, which is a key feature in making both on-demand and spot services accessible. Simulation results show that, by complementing the on-demand market with a spot market, a cloud provider can improve revenue by up to 461.5%. The framework is designed under assumptions that are met in real environments. It is a new tool that other cloud operators can use to quantify the advantage of a hybrid spot and on-demand service, making the case for eventually integrating this service model into their own infrastructures.