Oh dear, I thought it was different.
If you want to raise the pot I thought you could count your call as part of the pot before calculating the raise. Therefore 20+40+40+40+140.
He calls 40, then raises the pot, which is 20+40+40+40
= 40+20+40+40+40 = 180