Researchers at the University of Edinburgh found 45 to 54-year-old Scots spend on average 7.8 hours per weekday sitting down.
That compares to 7.4 hours of sedentary time for the over-75s.
Sedentary time is defined as time spent in any waking activity done while sitting, including working, eating, watching TV or time on a computer.
The study group said the figures highlighted the potential health risks of excessive sitting at work.
Experts say that high levels of sedentary time - more than seven hours a day - increases the risk of an early death, cardiovascular disease, type 2 diabetes and some cancers, even if people are physically active at other times of the day
Only the youngest group surveyed - 16 to 24-year-olds - are less sedentary than the over 75s on weekdays.
The findings from the University of Edinburgh's Physical Activity for Health Research Centre are published in the Journal of Sports Sciences.
Researchers drew upon data from more than 14,000 people in Scotland, taken from the 2012-14 Scottish Health Survey.
At the weekend, the weekday situation reverses. Those aged 25 to 54 were the least sedentary, sitting for between 5.2 and 5.7 hours a day. The over 75s were the most sedentary, at 7.3 to 7.4 hours a day.
For the youngest group, most of the time sitting down is in front of a TV or screen.
Men spend less time in front of a screen as they get older, with women peaking in middle-age.
Lead researcher Tessa Strain said: "Large parts of the population are dangerously sedentary, something we have underestimated.
"We need to tackle high levels of sedentary time in early and middle age, when patterns may develop.
"Our findings suggest that changing habits in the workplace could be an appropriate place to start, given how much time we spend sitting there every day."
Most middle-aged office workers now spend more time sitting down than pensioners, according to a new study.