In Internet of Things (IoT) systems, a number of sensor devices monitor the physical system states and exchange information with each other. The main limitation is that the IoT devices are generally energy constrained since those are powered with batteries. To address this energy problem, we consider a cooperative wireless-powered communication network (WPCN), which consists of three phases: 1) downlink (DL) energy transfer from a multi-antenna access point (AP); 2) data sharing among IoT devices; and 3) uplink (UL) information transfer from single-antenna IoT devices. Based on the shared data and the harvested energy, the single-antenna IoT devices in the neighborhood cooperate to form a virtual antenna array in order to transmit their information simultaneously to the multi-antenna AP using a multiple-input multiple-output (MIMO) technique in the UL information transfer phase. In this study, the transmit covariance matrices (i.e., beamforming vectors and the corresponding transmit power allocation) used for both DL energy transfer and UL information transfer are jointly designed to maximize the UL capacity based on the Lagrangian method. Furthermore, the time allocation for each phase is optimized based on a stochastic gradient method. In the numerical results, it is shown that our proposed beamforming scheme and the stochastic time allocation can achieve near-optimal performance.