As it happens, I've worked exclusively from a home office for more than 10 years and consequently learned a lot about keeping productive and sane in this environment. Here are some pointers:
1. Decide to enjoy solitude.
Working in an office with other people does provide a sense of connection that's lost when you work at home. Working at home means spending many hours each day with only yourself for company. Since that's the case, you might as well decide to enjoy it.
2. Cut down your work hours.
Office workers spend huge amounts of time in commutes, chitchats, useless meetings, and generally "looking busy." When you work at home, you don't pay that productivity tax, so you'll be able to get twice as much done in half the time.
3. Don't hang out at Starbucks.
When people start working from home full time, they sometimes end up at Starbucks (or someplace else that has free Wi-Fi) because they miss the bustle of the office. I've learned it's best to bite the bullet and embrace the solitude.
4. Stay out of the damn kitchen.
About the time I started working from home, an ex-boss of mine did the same. In the first six months, he gained about 50 pounds just because he could always bop into the kitchen for a quick snack. Resist that temptation and eat regular meals instead.
5. Set a timer for computer games.
Since there's nobody looking over your shoulder and tut-tutting, it's entirely up to you if you want to blow off a few hours playing computer games, web browsing, binge-watching, etc. Use a timer to keep the recreation from getting out of control.
6. Don't set up shop in your bedroom.
If you put your home office in your bedroom, you'll end up with insomnia. Instead, turn where you sleep at night into a haven away from work. Avoid answering work emails and texts when you're in bed. I learned this one the hard way.
7. Use your telephone sparingly.
When I first started working at home, I would call friends and family and then talk their ears off, just to avoid doing real work. Now I only take scheduled calls of limited duration. That way I remain productive and avoid pestering people.
8. Regularly declutter your office.
Because there's no reason to maintain appearances in a home office, it's easy to let it become a pigpen. Eventually, though, the clutter gets in the way of getting things done, so throw away some of that crap before it becomes a burden.
9. Make yourself comfortable.
Get a high-end desk chair; raise your screen to eye level; create multiple workspaces as necessary so that you can relax as you get stuff done. As an example, here's a video of my home office: