As a remote developer, setting a schedule for yourself is really important -- at least when you are getting started. Once you have an established work pattern that you are happy with you can experiment to see how things work.

I recommend doing what you are doing until you feel like, "OK. I'm in a rhythm and things are going well." Perhaps you are already at that point.

Next, when you have one of those days where you are feeling good and want to continue, work an extra hour. Then play with how you are going to use that hour the next day. Will you start late, or leave early or have a long lunch, or whatever? Tell your coworkers that you're going to do it. "I worked late today, so I'm going to X tomorrow". This keeps them informed so that they don't panic if they are looking for your help the next day.

Evaluate the progress. Did it feel good to you? For example, starting late does not work for me. I'm a morning person and taking an hour or two off in the morning means that I will get started on my side projects... and never stop. Then I end up working my "day job" until midnight --- no good!

Also, evaluate the reaction on your team. Were they OK with your behaviour? Every team is different. It's important to try to work with the team and not just stubbornly go your own way. I've worked with people who have the attitude, "It's my right to do whatever I want. I'll come in at 2pm and leave at 4pm and make up the time when it suits me". I hate working with people like that because programming is a team sport and I have to accommodate your weird schedule.

I work time shifted by 9 hours from the rest of my team. I know it impacts them and I do whatever I can to help them -- including working late nights sometimes (even though I'm a morning person). But you do what you can. Some of my colleagues can't get up early in the morning, so I'm happy to accommodate them, just like they are happy to accommodate my choice to live on the other side of the world. There is a give and take there, and as long as you are aware of it (and not always taking), then I think it's fine.

Deciding whether or not to work late is always a judgement call. My advice is to consider 2 things.

1: Is it truly and emergency? The server is on fire and you are losing customers. Somebody needs to work on it. You should stay if at all possible. Even staying around to provide moral support for your colleagues can make a big difference. Sometimes there is nothing you can do, but if you hang around and read slack (or however you communicate) and make occasional comments, it can really help the team. Nothing is more lonely than sitting in front of a melting down server, not having a clue what to do and everybody has buggered off for beer.

Sometimes people say it's an emergency and it really isn't. In those cases, consider the cost of saying no. There will be a cost if someone asks (or hints strongly) for you to stay and you say no. It sucks. It's not what it should be. But it's very common. If you can afford to pay the price, then feel free to draw the boundary. If you can not, then do what you have to -- and then try to get yourself into a situation where you can afford to say no the next time.

2: If you just feel like working, then go for it. Keep in mind that this comes after you have established a "normal" working day for yourself and when you know how to take back the time later. But stopping yourself from having fun (even if it's making other people money) is just silly.

Always keep in mind your own health, though. When I was younger, I seemed to be able to work a lot of hours and still stay very energised. As I've gotten older, I can not longer do that. I have to pay attention to my energy level, because a 12 hour stint can wreck me for the next 2 days. That's no good for anyone.

Finally, I occasionally work a short day when I'm really not on the ball. Again, I confer with my colleagues before I make any decisions. People know I'm usually around between 9am and noon their time. Sometimes I need that time off and around 9am I say, "I'm not getting anything done today, so I'm thinking about packing it in for the day. Is there anything that somebody needs me to do before I go?" Sometimes there are lots of things, and I stay and do what I can -- which is good because that often makes me productive, when I wasn't before. But if there isn't anything pressing, I'll rest and be able to do a very productive day the next day. That kind of thing really depends on the team and the amount of trust everybody has in everybody else. It won't fly on some teams, but I work with a good team.