Rest and activity are fundamental and complementary indices of animal behavior. Monitoring lying behaviour (LB) for individual dairy cows can advance precision dairy farming by indicating animal comfort in different housing conditions and physiological status. The objectives were: 1) to study diurnal lying behaviour (LB) of dairy cows under normal commercial management routine; 2) to compare the effects on LB of different housing systems; 3) to study LB in relation to activity, normally and during oestrus. A leg-mounted sensor to monitor and register lying times was developed, tested, and found reliable. Data were downloaded during milking times. In a first trial 12 multiparous cows in a roofed no-stalls barn, under comfortable thermal conditions. lay for 8.8 +/- 1.6 h per day. Lying periods ranged from 3.7 +/- 1.3 h, between 20:00 and 05:00, and 2.3 +/- 0.8 h, between 13:00 and 20:00. In a second trial, 8 first-calving cows were housed in each of two adjacent completely roofed barns: one no-stall and the other free-stall; the third trial repeated the second trial, with 4 cows from each group interchanged. In both trials, cows of both groups demonstrated diurnal lying patterns similar to that of trial 1, except that those in the no-stall barn lay for 2 It more then those in the free-stall barn. The free-stall cows were more active; there was a significant negative correlation between activity and lying time in the free-stall barn, and no correlation in the no-stall barn. Lying time was significantly shorter in cows that were in oestrus, in accordance with the increase in activity. The lying sensor can indicate the suitability of housing conditions for animal comfort, can improve oestrus detection, and probably can provide early indication of health problems.