User preferences are usually dynamic in real-world recommender systems, and a user's historical behavior records may not be equally important when predicting his/her future interests. Existing recommendation algorithms - including both shallow and deep approaches - usually embed a user's historical records into a single latent vector/representation, which may have lost the per item- or feature-level correlations between a user's historical records and future interests. In this paper, we aim to express, store, and manipulate users' historical records in a more explicit, dynamic, and effective manner. To do so, we introduce the memory mechanism to recommender systems. Specifically, we design a memory-augmented neural network (MANN) integrated with the insights of collaborative filtering for recommendation. By leveraging the external memory matrix in MANN, we store and update users' historical records explicitly, which enhances the expressiveness of the model. We further adapt our framework to both item- and feature-level versions, and design the corresponding memory reading/writing operations according to the nature of personalized recommendation scenarios. Compared with state-of-the-art methods that consider users' sequential behavior for recommendation, e.g., sequential recommenders with recurrent neural networks (RNN) or Markov chains, our method achieves significantly and consistently better performance on four real-world datasets. Moreover, experimental analyses show that our method is able to extract the intuitive patterns of how users' future actions are affected by previous behaviors.