One of the research tasks, which should be solved to develop a sleep monitor, is sleep stages classification. This paper presents an algorithm for wakefulness, rapid eye movement sleep (REM) and non-REM sleep detection based on a set of 33 features, extracted from respiratory inductive plethysmography signal, and bagging classifier. Furthermore, a few heuristics based on knowledge about normal sleep structure are suggested. We used the data from 29 subjects without sleep-related breathing disorders who underwent a PSG study at a sleep laboratory. Subjects were directed to the PSG study due to suspected sleep disorders. A leave-one-subject-out cross-validation procedure was used for testing the classification performance. The accuracy of 77.85 ± 6.63 and Cohen's kappa of 0.59 ± 0.11 were achieved for the classifier. Using heuristics we increased the accuracy to 80.38 ± 8.32 and the kappa to 0.65 ± 0.13. We conclude that heuristics may improve the automated sleep structure detection based on the analysis of indirect information such as respiration signal and are useful for the development of home sleep monitoring system.