Freeway on-ramps are typical bottlenecks in the freeway network due to the frequent disturbances caused by their associated merging, weaving, and lane-changing behaviors. With real-time communication and precise motion control, Connected and Autonomous Vehicles (CAVs) provide an opportunity to substantially enhance the traffic operational performance of on-ramp bottlenecks. In this paper, we propose an upper-level control strategy to coordinate the two traffic streams at on-ramp merging through proactive gap creation and platoon formation. The coordination consists of three components: (1) mainline vehicles proactively decelerate to create large merging gaps; (2) ramp vehicles form platoons before entering the main road; (3) the gaps created on the main road and the platoons formed on the ramp are coordinated with each other in terms of size, speed, and arrival time. The coordination is formulated as a constrained optimization problem, incorporating both macroscopic and microscopic traffic flow models, for flow-level efficiency gains. The model uses traffic state parameters as inputs and determines the optimal coordination plan adaptive to real-time traffic conditions. The benefits of the proposed coordination are demonstrated through an illustrative case study. Results show that the coordination is compatible with real-world implementation and can substantially improve the overall efficiency of on-ramp merging, especially under high traffic volume conditions, where recurrent traffic congestion is prevented, and merging throughput increased.