PRIMARY OBJECTIVES:
I. To evaluate the efficacy of pembrolizumab and sunitinib malate (sunitinib) for the treatment of patients with thymic carcinoma that have progressed on prior treatment as measured by objective response rate.
SECONDARY OBJECTIVES:
I. To evaluate the safety profile and toxicity of combination pembrolizumab and sunitinib malate as per Common Terminology Criteria for Adverse Events (CTCAE) version (v) 4.0.
II. To evaluate the progression free survival (PFS) and overall survival (OS) of patients treated with combination pembrolizumab and sunitinib.
EXPLORATORY OBJECTIVES:
I. To determine objective response rate (ORR), PFS, and OS by PD-L1 expression \> 50% tumor proportion score (TPS) (by 22C3 assay) II. To determine whether sunitinib treatment leads to increase in PD-L1 expression and tumor infiltrating lymphocytes and decrease in myeloid-derived suppressor cells (MDSC) in both tumor and peripheral blood.
OUTLINE:
Participants receive pembrolizumab intravenously (IV) over 30 minutes on day 1 and sunitinib malate orally (PO) daily on days 1-14. Courses repeat every 21 days for 24 months in the absence of disease progression or unacceptable toxicity.
After completion of the study treatment, participants are followed up for 30 days, every 6 weeks for 1 year, and every 9 or 12 weeks thereafter.
Inclusion Criteria:
* Be willing and able to provide written informed consent/assent for the trial
* Have histologically or cytologically-documented diagnosis of advanced (metastatic and/or unresectable) thymic carcinoma, for which no curative treatment (including surgery, radiation, or other) is available
* Have experienced progressive disease after at least one previous regimen of platinum-based chemotherapy. Prior platinum-containing adjuvant, neoadjuvant, or definitive chemoradiation therapy given for locally advanced disease is considered first line therapy only if recurrent (local or metastatic) disease developed within 6 months of completing therapy. Subjects with recurrent disease \< 6 months will be eligible. Patients who have not had prior platinum-based chemotherapy for documented reasons (e.g., refusal or drug supply issues) may be eligible for study entry at the discretion of the sponsor investigator.
* Have measurable disease based on Response Evaluation Criteria in Solid Tumors (RECIST) 1.1
* Availability of a recent formalin-fixed, paraffin-embedded (FFPE) tumor tissue block; a recently obtained archival FFPE tumor tissue block (if an FFPE tissue block cannot be provided, 15 unstained slides \[10 minimum\] will be acceptable) from a primary or metastatic tumor resection or biopsy can be provided if it was obtained within 3 years of trial screening; patients with tumor specimens older than 3 years may still be eligible if deemed so by study sponsor
* Be willing to provide tissue from an on-treatment fine-needle aspiration (FNA) or core biopsy of a tumor lesion; subjects must consent to on-treatment biopsy prior to initiation of clinical trial, however in subjects for whom newly-obtained samples cannot be provided (e.g. inaccessible or subject safety concern) may still continue on study
* Be willing to provide peripheral blood samples at screening and day 1 of cycle 2 and cycle 3 for correlative studies
* Have a performance status of 0 or 1 on the Eastern Cooperative Oncology Group (ECOG) performance scale
* Life expectancy greater than 3 months
* Ability to swallow and retain oral medication
* No evidence of uncontrolled hypertension as documented by 2 baseline blood pressure (BP) readings taken at least 1 hour apart; the baseline systolic BP readings must be =\< 140 mm Hg, and the baseline diastolic BP readings must be =\< 90 mm Hg; use of antihypertensive medications to control BP is allowed
* Left ventricular ejection fraction (LVEF) \>= lower limit of normal (LLN) as assessed by either multigated acquisition (MUGA) scan or echocardiogram (ECHO)
* Absolute neutrophil count (ANC) \>= 1,500 /mcL, performed within 28 days of treatment initiation
* Platelets \>= 100,000 / mcL, performed within 28 days of treatment initiation
* Serum creatinine =\< 1.5 X upper limit of normal (ULN) OR measured or calculated creatinine clearance (glomerular filtration rate \[GFR\] can also be used in place of creatinine or CrCl) \>= 60 mL/min for subject with creatinine levels \> 1.5 X institutional ULN, performed within 28 days of treatment initiation
* Serum total bilirubin =\< 1.5 X ULN OR direct bilirubin =\< ULN for subjects with total bilirubin levels \> 1.5 ULN, performed within 28 days of treatment initiation
* Aspartate aminotransferase (AST) (serum glutamic oxaloacetic transaminase \[SGOT\]) and alanine aminotransferase (ALT) (serum glutamic pyruvic transaminase \[SGPT\]) =\< 2.5 X ULN OR =\< 5 X ULN for subjects with liver metastases, performed within 28 days of treatment initiation
* Albumin \>= 2.5 mg/dL, performed within 28 days of treatment initiation
* International normalized ratio (INR) or prothrombin time (PT) =\< 1.5 X ULN unless subject is receiving anticoagulant therapy as long as PT or partial thromboplastin time (PTT) is within therapeutic range of intended use of anticoagulants, performed within 28 days of treatment initiation
* Activated partial thromboplastin time (aPTT) =\< 1.5 X ULN unless subject is receiving anticoagulant therapy as long as PT or PTT is within therapeutic range of intended use of anticoagulants, performed within 28 days of treatment initiation
* Female subject of childbearing potential should have a negative urine or serum pregnancy within 72 hours prior to receiving the first dose of study medication; if the urine test is positive or cannot be confirmed as negative, a serum pregnancy test will be required
* Female subjects of childbearing potential must be willing to use an adequate method of contraception for the course of the study through 120 days after the last dose of study medication
* Note: abstinence is acceptable if this is the usual lifestyle and preferred contraception for the subject
* Male subjects of childbearing potential must agree to use an adequate method of contraception starting with the first dose of study therapy through 120 days after the last dose of study therapy
* Note: abstinence is acceptable if this is the usual lifestyle and preferred contraception for the subject
Exclusion Criteria:
* Is currently participating and receiving study therapy or has participated in a study of an investigational agent and received study therapy or used an investigational device within 4 weeks of the first dose of treatment
* Has received prior sunitinib or pembrolizumab therapy for the treatment of malignancy
* Has a diagnosis of immunodeficiency or is receiving systemic steroid therapy or any other form of immunosuppressive therapy within 7 days prior to the first dose of trial treatment
* Has a known history of active tuberculosis (TB) (Bacillus tuberculosis)
* Hypersensitivity to pembrolizumab or sunitinib or any of their excipients
* Has had prior chemotherapy, targeted small molecule therapy, or radiation therapy within 2 weeks prior to study day 1 or who has not recovered (i.e., =\< grade 1 or at baseline) from adverse events due to a previously administered agent
* Note: subjects with =\< grade 2 neuropathy due to chemotherapy are an exception to this criterion and may qualify for the study
* Note: if subject received major surgery, they must have recovered adequately from the toxicity and/or complications from the intervention prior to starting therapy
* Has a known additional malignancy that is progressing or requires active treatment; exceptions include basal cell carcinoma of the skin or squamous cell carcinoma of the skin that has undergone potentially curative therapy or in situ cervical cancer
* Has known active central nervous system (CNS) metastases and/or carcinomatous meningitis; subjects with previously treated brain metastases may participate provided they are stable (without evidence of progression by imaging for at least four weeks prior to the first dose of trial treatment and any neurologic symptoms have returned to baseline), have no evidence of new or enlarging brain metastases, and are not using steroids for at least 7 days prior to trial treatment; this exception does not include carcinomatous meningitis which is excluded regardless of clinical stability
* Has active autoimmune disease, including myasthenic syndrome, which has required systemic treatment in the past 2 years (i.e. with use of disease modifying agents, corticosteroids or immunosuppressive drugs); replacement therapy (eg., thyroxine, insulin, or physiologic corticosteroid replacement therapy for adrenal or pituitary insufficiency, etc.) is not considered a form of systemic treatment
* Has an active infection requiring systemic therapy
* Has a history or current evidence of any condition, therapy, or laboratory abnormality that might confound the results of the trial, interfere with the subject?s participation for the full duration of the trial, or is not in the best interest of the subject to participate, in the opinion of the treating investigator
* Has known psychiatric or substance abuse disorders that would interfere with cooperation with the requirements of the trial
* Is pregnant or breastfeeding, or expecting to conceive or father children within the projected duration of the trial, starting with the pre-screening or screening visit through 120 days after the last dose of trial treatment
* Has received prior therapy with an anti-PD-1, anti-PD-L1, or anti-PD-L2 agent
* Has a known history of human immunodeficiency virus (HIV) (HIV 1/2 antibodies)
* Has known active hepatitis B (e.g., hepatitis B surface antigen \[HBsAg\] reactive) or hepatitis C (e.g., hepatitis C virus \[HCV\] ribonucleic acid \[RNA\] \[qualitative\] is detected)
* Has received a live vaccine within 30 days of planned start of study therapy
* Note: seasonal influenza vaccines for injection are generally inactivated flu vaccines and are allowed; however intranasal influenza vaccines (e.g., Flu-Mist) are live attenuated vaccines, and are not allowed
* Significant proteinuria at baseline (\> 500 mg/ 24 h, or \> 2+ on spot analysis)
* Serious non-healing wound, ulcer or bone fracture
* Evidence of bleeding diathesis or coagulopathy
* Grade \>= 3 hemorrhage within 4 weeks of patient randomization
* Recent (\< 6 months) arterial thromboembolic events, including transient ischemic attack, cerebrovascular accident, unstable angina, or myocardial infarction
* Ongoing cardiac dysrhythmias of National Cancer Institute (NCI) CTCAE grade \>= 2 or prolongation of the corrected QT interval (QTc) interval to \> 500 msec
* Current use or anticipated need for treatment with drugs or foods that are known strong CYP3A4/5 inhibitors, including their administration within 10 days prior to patient treatment with study drug (eg, grapefruit juice or grapefruit/grapefruit-related citrus fruits \[eg, Seville oranges, pomelos\], ketoconazole, miconazole, itraconazole, voriconazole, posaconazole, clarithromycin, erythromycin, telithromycin, indinavir, saquinavir, ritonavir, nelfinavir, amprenavir, fosamprenavir nefazodone, lopinavir, troleandomycin, mibefradil, and conivaptan); the topical use of these medications (if applicable), such as 2% ketoconazole cream, is allowed
* Current use or anticipated need for drugs that are known strong CYP3A4/5 inducers, including their administration within 10 days prior to patient randomization, eg, phenobarbital, rifampin, phenytoin, carbamazepine, rifabutin, rifapentin, clevidipine, St John?s wort
* Any condition which in the investigator?s opinion deems the participant an unsuitable candidate to receive study drug
Other Respiratory and Intrathoracic Organs
Thyroid