Lying time is an important measure of cow comfort, and the lying behavior of dairy cattle can now be recorded automatically with the use of accelerometers. To assess the effect that stall stocking density and the time that cows spend away from the home pen being milked has on the lying behavior of Holstein cattle, a total of 111 commercial freestall dairy farms were visited in Canada. Accelerometers were used to automatically record the lying behavior of 40 focal cows per farm. Total duration of lying, lying bout frequency, and the mean duration of lying bouts were calculated. Pen population was the total number of cows in the pen. To calculate stall stocking density (%) the number of cows in the pen and the number of useable stalls were counted and multiplied by 100, and the length × width of the pen was divided by the number of cows in the pen to calculate area/cow (m2). Time away from the pen per day was recorded from when the first cow in each pen was taken out of the home pen for milking until the last cow returned to the home pen after milking, and this time was multiplied by daily milking frequency. The results show that the median value for lying duration at the farm level was 10.6 h/d, with 10.5 lying bouts/d, and a median lying bout duration of 1.2 h. Stall stocking density ranged from 52.2 to 160.0%, with very few farms (7%) stocking at greater than 120%. Although stall stocking density was not significantly correlated with lying behavior, the results showed that no farm with stocking density greater that 100% achieved an average herd lying duration of 12 h/d or higher, whereas 21.6% of farms with a stocking density of 100% or less did achieve the target lying time of ≥12 h/d, as recommended by the Canadian Code of Practice (χ2 = 4.86, degrees of freedom = 1). Area/cow (m2) was not correlated with any aspect of lying behavior, but regardless of space per cow, pen population was correlated with daily frequency and duration of lying bouts. As the number of cows in the pen increased, lying daily bout frequency increased (correlation coefficient = 0.24) and lying bout duration decreased (correlation coefficient = −0.30). Lying behavior was affected by the time the cows were away from the pen being milked. When cows were away from the pen for longer than 3.7 h/d, no farm achieved the recommended herd median lying time of 12 h/d or longer. These results suggest that providing 1 stall for each cow in the pen and minimizing time away from the pen are important factors if cattle are to achieve the recommended daily lying duration of 12 h/d.