Background and objective: Single-channel EEG is the most popular choice of sensing modality in sleep staging studies, because it widely conforms to the sleep staging guidelines. The current deep learning method using single-channel EEG signals for sleep staging mainly extracts the features of its surrounding epochs to obtain the short-term temporal context information of EEG epochs, and ignore the influence of the long-term temporal context information on sleep staging. However, the long-term context information includes sleep stage transition rules in a sleep cycle, which can further improve the performance of sleep staging. The aim of this research is to develop a temporal context network to capture the long-term context between EEG sleep stages.Methods: In this paper, we design a sleep staging network named SleepContextNet for sleep stage sequence. SleepContextNet can extract and utilize the long-term temporal context between consecutive EEG epochs, and combine it with the short-term context. we utilize Convolutional Neural Network(CNN) layers for learning representative features from each sleep stage and the representation features sequence learned are fed into a Recurrent Neural Network(RNN) layer for learning long-term and short-term context information among sleep stage in chronological order. In addition, we design a data augmentation algorithm for EEG to retain the long-term context information without changing the number of samples.Results: We evaluate the performance of our proposed network using four public datasets, the 2013 version of Sleep-EDF (SEDF), the 2018 version of Sleep-EDF Expanded (SEDFX), Sleep Heart Health Study (SHHS) and the CAP Sleep Database. The experimental results demonstrate that SleepContextNet outperforms state-of-the-art techniques in terms of different evaluation metrics by capturing long-term and short-term temporal context information. On average, accuracy of 84.8% in SEDF, 82.7% in SEDFX, 86.4% in SHHS and 78.8% in CAP are obtained under subject-independent cross validation.Conclusions: The network extracts the long-term and short-term temporal context information of sleep stages from the sequence features, which utilizes the temporal dependencies among the EEG epochs effectively and improves the accuracy of sleep stages. The sleep staging method based on forward temporal context information is suitable for real-time family sleep monitoring system.