Smart devices become prevalent in our daily lives, as the advancement of mobile networks, sensor technologies and distributed computing. They easily collect rich context information (e.g., time, GPS location, Wifi info, app usage, etc.) from the device owners (i.e., the users). Modeling such sequential context data is important — it not only helps to profile the user, but also enables many context-aware applications, such as location-based services with the next location prediction and app usage predictions. However, context modeling is challenging, because the context data is heterogeneous and high-dimensional in terms of the huge number of possible contexts. In this paper, we propose a novel Collaborative Hidden Markov Model (CHMM). CHMM extends the sequential generative model HMM to a collaborative setting, such that only those users sharing similar behaviors can pool their data together to build a reliable model. We evaluate CHMM with real-world data for both next location prediction and app usage prediciton, and the results show that CHMM outperforms the baselines in both cases.