 This is a Phase II trial to determine the efficacy and safety of stereotactic body radiation therapy SBRT and in situ oncolytic virus therapy used as a window of opportunity treatment before pembrolizumab in patients with metastatic triple negative breast cancer TNBC and metastatic non-small cell lung cancer NSCLC. In situ oncolytic virus therapy will consist of adenovirus-mediated expression of herpes simplex virus thymidine kinase ADVHSV-tk plus valacyclovir. Male and female patients aged 18 years with histologically confirmed locally advanced or metastatic TNBC that has relapsed on or is refractory to 1 or more lines of standard of care therapy or histologically or cytologically confirmed metastatic NSCLC that is immunotherapy and chemotherapy naïve or previously treated with 1 cycle of platinum-containing chemotherapy are eligible to participate in the study. ADVHSV-tk 5 x 1011 viral particles in a 2-mL total volume will be injected intratumorally on Day 0 of the study. Valacyclovir will be orally administered at a dose of 2 g three times daily for 14 days. Valacyclovir treatment will be administered 24 hours after the gene vector injection from Day 1 to Day 15 of the study. SBRT of 30 gray Gy; 6 Gy X 5 fractions will be administered over 2 weeks from Day 2 to Day 16 of the study. Pembrolizumab 200 mg will be administered intravenously over 30 minutes every 3 weeks starting on Day 17 of the study and continuing until disease progression, unacceptable toxicity, or up to 24 months in patients without disease progression. The primary endpoint will be the objective response rate of ADVHSV-tk valacyclovir therapy in combination with SBRT used as a window of opportunity treatment before pembrolizumab in patients with metastatic TNBC and metastatic NSCLC. RECIST 1.1 will be used to assess treatment response. Secondary endpoints will include a duration of response; b overall survival and progression-free survival rates; c toxicity toxicity will be defined as any treatment-related death or any grade 3 toxicity excluding alopecia and constitutional symptoms as assessed by the NCI CTCAE v4.03; and d antitumor activity of ADVHSV-tk plus valacyclovir therapy in combination with SBRT used as a window of opportunity treatment before pembrolizumab. 