If working from home is new to you or you get too distracted, it helps a lot to give the day at home the same structure that you would have at work. Also, the rituals that you maintain at home before you go to work can help to switch from home mode to work mode and back to off-hours mode.
What does this look like in practice?
Set your alarm.
Get up and get dressed (do not fall into the "in your pyjamas in front of the computer" trap!).
"Go to work" - Use the time you would otherwise spend travelling to and from work, walking around the block or other exercise.
Plan your working day including breaks.
You work during working hours.
In your break time, take a break - as long as planned (see also the Pomodoro Technique).
Use your breaks, go out and get some exercise, spend time with the children or have lunch with your partner. A real danger in the home office is that you spend too much time in front of your computer and move around too little. This is not good for your concentration or your health.
Call it a day when it's quitting time. You've worked your hours.
Tip: Set a timer for the individual phases so that you don't fall into one extreme or the other.