No activity, none, zilch, keep him calm quiet & crated. Your vet is right, as the heartworms die they start to flow around in the arteries and out of the heart, etc. You want the heartworms to come out slowly, if he bounces around he can unclog a big section of worms all at once which could cause a blockage which would be very bad.
We went through it with our lab, its tough, it's scary and it's a pain in tushy, we had to stop the treatment the first time due to her getting pneumonia. Doc put her on antibiotics, waited until she was better from that and restarted the treatment at a slower rate the next time.
PS: Maybe some frozen kongs, bones, puzzle toys to help keep him occupied. I feel your pain, our lab was a wild-child and it was tough keeping her calm also.