Normally, you shouldn't.
The deal has been arranged for 40 hours + probably a few legally allowed extra hours. A deal is a deal.
You can freely decide to work more if you feel obligated. Say, the employer pays you 150% of the usual market price and/or offers you benefits beyond the contract.
By agreeing to work more for no extra compensation you undermine the respect for you.
Remarks like "Work more to maybe get a pay rise" is a nonsense. It should be "Pay more and I may consider working more".
If you are regularly missing deadling by only working 40 hours then:
- You are not proficient enough (you would know that and not ask a question here in this case)
- The management is not good at planning work and assigning resources
- You are being given work for more than 40 hours to complete. This is a case of cost saving by the company. Since it does not bring you anything, no point in participating in it.
Should you be suggested that "There are many people there outside who would take your place and work more for no extra money", you can respond "There are many places there outside who would give me the same money and not require any extra hours".
P.S. I do count my 40 hours. Since I need my free time to work on some personal projects, I'm not going to sacrifice it.
P.S. #2. As it is widely known, programmers cannot work for more that 4-5 hours per day with full dedication and commitment. Forcing them to even stretch over 8 is pointless. My total coding time per day is though usually more than 8 hours (work + personal projects), but because of the context switch it works well.