I was previously working in an office from 9-6 but my boss decided for us to work remotely due to various reasons.
When I was in an office setting, I had no choice but to stay in the office from 9-6 PM, no matter how many tasks I have for the day.
However, now that I work from home, I find it more productive if I work on a task-basis rather than on a time-basis. I just set 3 important tasks to finish for the day (+ a couple of minor tasks). Sometimes, I end at 4PM or 5PM (1-2 hours earlier than my office log-out time). After that, I usually do other things but I'm still logged into our IM up to 6PM (in case, something urgent needs to be fixed). (There are even days when there's absolutely nothing to do so I do other things.)
Is what I'm doing ethical? I feel that my current set-up is the right balance for me though -- something that I have the privilege of implementing because I don't need to be in an office space for X hours. As long as I get the job done as per schedule.
(Additional info asked in the comments: I am salaried. When I said there's absolutely nothing to do, I do let my boss know. I agree that I can use this time to do some cleaning up / other operational stuff.
The reason I don't start another task (sometimes) even if I have some hours left is if the next task requires a huge mental bandwidth. As a creative, this mental bandwidth is almost depleted around 4-5PM. I usually reserve afternoon for the easy tasks that don't require much thinking. This is how I maintain my optimal productivity.)