[verb て-form] + まで [noun] + までして
てまで means "going so far as to ~". It goes after the て-form of a verb, and that verb names a cost – borrowing money, lying, losing sleep – paid for what the second half describes.
The speaker finds the cost out of proportion. Mostly that comes out as criticism or refusal, but it can also be surprise at how far someone went.
Many sentences with てまで say the goal is not worth the cost, ending in ひつよう必要はない, ことはない or たくない.
With a noun, the same idea is までして: しゃっきん借金までして, "going as far as debt". そこまでして points back at a cost already mentioned.