The users on the Internet have been growing exponentially, and tag recommendation can automatically provide users with a selection of tags of interest to meet their personalized needs. Users can utilize these tags to freely annotate their favorite resources, making them efficient and fast in retrieving related resources. Tensor factorization methods are commonly used in tag recommendation at present. These methods model the user × item × tag interactions, transform the latent feature representations of users, items and tags into low-rank matrices and use inner products for prediction. However, the problem of using inner product is that it does not satisfy the triangle inequality, it ignores the distance relationship among entity pairs and cannot capture the fine-grained preference information. Metric learning in recommendation domains focus on using pairwise loss, which assumes that different categories (such as users, items and tags) have fixed margins. Different categories often have different intra-class variations. With fixed margins, it is often difficult to accurately distinguish between positive and negative samples, thus reducing recommendation performance and limiting the expression ability of the model. In this study, the metric learning method is used to explore the distance relationship among user × item × tag triplet, and the existing metric learning based methods (namely LRML, CML, SML) are applied to the tag recommendation. A pairwise metric learning method with angular margin is proposed, named PMLT. The pairwise distance relationship between user-tag and item-tag is modeled for the information of different entities. And an extra angular margin regularizer is added to the original pairwise loss to control the size of angular margin for user-tag and item-tag respectively. The strength of the constrained angular margin regularizer is controlled to dynamically adjust the distance changes of entity. This method constrains the fixed margin and also the angular margin of user-tag and item-tag. Compared with the traditional metric learning method, this method can capture additional relationship structure and has good recommendation performance. Finally, we conducted extensive experiments on two datasets, LastFm and Movielens, and the experimental results showed that the proposed method PMLT outperform the state-of-the-art baseline in the evaluation metrics Recall@N and NDCG@N, and obtain better prediction quality. We also analyze the influence of different parameters and internal components on the performance of the proposed method, which improves the interpretability of the proposed method.INDEX TERMS Tag recommendation, tensor factorization, metric learning, angular margin.