This paper is devoted to an inverse problem of simultaneously determining the spatially dependent source term and the Robin boundary coefficient in a time fractional diffusion equation, with the aid of extra measurement data at a subdomain near the accessible boundary. Firstly, the spatially varying source is uniquely determined in view of the unique continuation principle and Duhamel principle for the fractional diffusion equation. The Hopf lemma for a homogeneous time-fractional diffusion equation is proved and then used to prove the uniqueness of recovering the Robin boundary coefficient. Numerically, based on the theoretical uniqueness result, we apply the classical Tikhonov regularization method to transform the inverse problem into a minimization problem, which is solved by an iterative thresholding algorithm. Finally, several numerical examples are presented to show the accuracy and effectiveness of the proposed algorithm.