US stay of 90 days - return after 40 days both under ESTA
Upvote:1
There is no 90/180 rule in the US like there's in Germany. You should be fine.
If it becomes a regular thing that you repeatedly come for long stays and short absences they might start asking questions, but it's not illegal on it's own.