<?xml version="1.0" encoding="us-ascii"?><InstanceReport xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><Version>2.4.0.8</Version><ReportLongName>121 - Disclosure - Licenses and Gain on Extinguishment of Debt</ReportLongName><DisplayLabelColumn>true</DisplayLabelColumn><ShowElementNames>false</ShowElementNames><RoundingOption /><HasEmbeddedReports>false</HasEmbeddedReports><Columns><Column FlagID="0"><Id>1</Id><IsAbstractGroupTitle>false</IsAbstractGroupTitle><LabelSeparator>

</LabelSeparator><CurrencyCode /><FootnoteIndexer /><hasSegments>false</hasSegments><hasScenarios>false</hasScenarios><MCU><KeyName /><CurrencySymbol /><contextRef><ContextID>eol_PE10315---13S-1-0008_STD_366_20121231_0</ContextID><EntitySchema>http://www.sec.gov/CIK</EntitySchema><EntityValue>0001069308</EntityValue><PeriodDisplayName /><PeriodType>duration</PeriodType><PeriodStartDate>2012-01-01T00:00:00</PeriodStartDate><PeriodEndDate>2012-12-31T00:00:00</PeriodEndDate><Segments /><Scenarios /></contextRef><UPS /><CurrencyCode /><OriginalCurrencyCode /></MCU><CurrencySymbol /><Labels><Label Key="CalendarSupplement" Id="0" Label="12 Months Ended" /><Label Key="Calendar" Id="1" Label="Dec. 31, 2012" /></Labels></Column></Columns><Rows><Row FlagID="0"><Id>1</Id><IsAbstractGroupTitle>false</IsAbstractGroupTitle><LabelSeparator>

</LabelSeparator><Level>4</Level><ElementName>opxa_SignificantAgreementsDisclosureTextBlock</ElementName><ElementPrefix>opxa_</ElementPrefix><IsBaseElement>false</IsBaseElement><BalanceType>na</BalanceType><PeriodType>duration</PeriodType><IsReportTitle>false</IsReportTitle><IsSegmentTitle>false</IsSegmentTitle><IsCalendarTitle>false</IsCalendarTitle><IsEquityPrevioslyReportedAsRow>false</IsEquityPrevioslyReportedAsRow><IsEquityAdjustmentRow>false</IsEquityAdjustmentRow><IsBeginningBalance>false</IsBeginningBalance><IsEndingBalance>false</IsEndingBalance><IsReverseSign>false</IsReverseSign><PreferredLabelRole>terseLabel</PreferredLabelRole><FootnoteIndexer /><Cells><Cell FlagID="0" ContextID="eol_PE10315---13S-1-0008_STD_366_20121231_0" UnitID=""><Id>1</Id><IsNumeric>false</IsNumeric><IsRatio>false</IsRatio><DisplayZeroAsNone>false</DisplayZeroAsNone><NumericAmount>0</NumericAmount><RoundedNumericAmount>0</RoundedNumericAmount><NonNumbericText>&lt;div&gt;
&lt;p style="MARGIN-TOP: 18px; MARGIN-BOTTOM: 0px"&gt;&lt;font style="FONT-FAMILY: Times New Roman" size="2"&gt;&lt;b&gt;Note 13. Licenses and
Gain on Extinguishment of Debt&lt;/b&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p style="MARGIN-TOP: 6px; MARGIN-BOTTOM: 0px"&gt;&lt;font style="FONT-FAMILY: Times New Roman" size="2"&gt;&lt;b&gt;&lt;i&gt;University of Chicago
License Agreement&lt;/i&gt;&lt;/b&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p style="MARGIN-TOP: 6px; TEXT-INDENT: 4%; MARGIN-BOTTOM: 0px"&gt;
&lt;font style="FONT-FAMILY: Times New Roman" size="2"&gt;In 2004, Opexa
entered into an agreement with the University of Chicago
(&amp;#x201C;University&amp;#x201D;) for the worldwide license to technology
developed at Argonne National Laboratory, a U.S. Department of
Energy Laboratory operated by the University. The license was later
amended granting Opexa an exclusive, non-transferable worldwide
license to the University&amp;#x2019;s stem cell technology. In
consideration for the license and amendment, Opexa paid the
University a total of $232,742 and issued the University 53,462
shares of common stock valued at $2,295,461. Opexa also agreed to
pay the University $1.5 million and to issue the University 21,623
shares of Opexa common stock. In April 2007, the $1.5 million cash
payment obligation was extended until July&amp;#xA0;31, 2007 and the
obligation to issue shares of Opexa&amp;#x2019;s common stock was
extended until July&amp;#xA0;31, 2007, with $112,440 accrued as of
June&amp;#xA0;30, 2007.&lt;/font&gt;&lt;/p&gt;
&lt;p style="MARGIN-TOP: 12px; TEXT-INDENT: 4%; MARGIN-BOTTOM: 0px"&gt;
&lt;font style="FONT-FAMILY: Times New Roman" size="2"&gt;In July 2007,
Opexa entered into a second amended and restated license agreement
with the University that eliminated the obligations under the prior
agreement for the payment of $1.5 million due July&amp;#xA0;31, 2007
and the obligation to issue 21,623 shares of Opexa common stock.
These obligations were recorded as an intangible asset, with the
liabilities recorded as a notes payable&amp;#x2014;current portion of
$1.5 million and a stock payable of $112,440. As a result of the
amendment and restatement of the license agreement with the
University, $1,612,440 was reported as a gain on extinguishment of
liability. Opexa applied the accounting guidance related to
transfers and servicing of financial assets and extinguishments of
liabilities as well as the guidance on debtor&amp;#x2019;s accounting
for a modification or exchange of debt instruments. In
August&amp;#xA0;2009, the University of Chicago license agreement was
assigned to Novartis as part of Opexa&amp;#x2019;s sale of its stem cell
technology platform to Novartis, and effective November&amp;#xA0;2,
2011, the license agreement was re-assigned to Opexa and the
license agreement was amended and restated, as further described
below.&lt;/font&gt;&lt;/p&gt;
&lt;p style="MARGIN-TOP: 18px; MARGIN-BOTTOM: 0px"&gt;&lt;font style="FONT-FAMILY: Times New Roman" size="2"&gt;&lt;b&gt;&lt;i&gt;Stem Cell Technology
Agreement&lt;/i&gt;&lt;/b&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p style="MARGIN-TOP: 6px; TEXT-INDENT: 4%; MARGIN-BOTTOM: 0px"&gt;
&lt;font style="FONT-FAMILY: Times New Roman" size="2"&gt;In August 2009,
Opexa entered into an exclusive agreement with Novartis for the
further development of its stem cell technology. This technology,
which has generated preliminary data, was in early preclinical
development. Under the terms of the agreement, Novartis acquired
the stem cell technology from Opexa and Novartis had full
responsibility for funding and carrying out all research,
development and commercialization activities. Opexa received an
upfront cash payment of $3 million at the time the agreement was
entered into and subsequently received $0.5 million as a technology
transfer milestone fee.&lt;/font&gt;&lt;/p&gt;
&lt;p style="MARGIN-TOP: 12px; TEXT-INDENT: 4%; MARGIN-BOTTOM: 0px"&gt;
&lt;font style="FONT-FAMILY: Times New Roman" size="2"&gt;In November
2011, Opexa re-acquired the stem cell assets from Novartis in
consideration for releasing Novartis with respect to any further
payment obligations owed to Opexa by Novartis In connection with
the re-acquisition of the stem cell assets, a related license
agreement with the University of Chicago was re-assigned to Opexa.
Opexa and the University of Chicago entered into a Fourth Amended
and Restated License Agreement in connection with such assignment
to Opexa.&lt;/font&gt;&lt;/p&gt;
&lt;/div&gt;</NonNumbericText><FootnoteIndexer /><CurrencyCode /><CurrencySymbol /><IsIndependantCurrency>false</IsIndependantCurrency><ShowCurrencySymbol>false</ShowCurrencySymbol><DisplayDateInUSFormat>false</DisplayDateInUSFormat></Cell></Cells><ElementDataType>nonnum:textBlockItemType</ElementDataType><SimpleDataType>na</SimpleDataType><ElementDefenition>Significant Agreements Disclosure.</ElementDefenition><ElementReferences>No definition available.</ElementReferences><IsTotalLabel>false</IsTotalLabel><UnitID>0</UnitID><Label>Licenses and Gain on Extinguishment of Debt</Label></Row></Rows><Footnotes /><IsEquityReport>false</IsEquityReport><ReportName>Licenses and Gain on Extinguishment of Debt</ReportName><MonetaryRoundingLevel>UnKnown</MonetaryRoundingLevel><SharesRoundingLevel>UnKnown</SharesRoundingLevel><PerShareRoundingLevel>UnKnown</PerShareRoundingLevel><ExchangeRateRoundingLevel>UnKnown</ExchangeRateRoundingLevel><HasCustomUnits>true</HasCustomUnits><IsEmbedReport>false</IsEmbedReport><IsMultiCurrency>false</IsMultiCurrency><ReportType>Sheet</ReportType><RoleURI>http://www.opexatherapeutics.com/taxonomy/role/NotesToFinancialStatementsSignificantAgreementsDisclosureTextBlock</RoleURI><NumberOfCols>1</NumberOfCols><NumberOfRows>1</NumberOfRows></InstanceReport>
