<PAGE>

                                                                    EXHIBIT 10.2

                                                                  Execution Form

                        FIRST AMENDMENT TO SECOND AMENDED
                          AND RESTATED CREDIT AGREEMENT

      This First Amendment to Second Amended and Restated Credit Agreement
("First Amendment") dated as of August 10, 2004 and effective as of the
Amendment Effective Date (as defined in Section 4 below), is by and among ULTRA
RESOURCES, INC., a Wyoming corporation ("Borrower"), the several banks and
financial institutions from time to time parties to this Credit Agreement (the
"Banks," such term to include all undersigned Banks and all other financial
institutions that subsequently become parties to the Credit Agreement (referred
to below)), BANK ONE, NA, a national banking association having its principal
office in Chicago, Illinois ("Bank One") as a Bank, as the LC Issuer and as
Administrative Agent for the Banks (in such latter capacity and together with
its successors and permitted assigns in such capacity, the "Administrative
Agent").

                                   WITNESSETH:

      WHEREAS, the Borrower, the Administrative Agent and the Banks have
heretofore entered into a certain Second Amended and Restated Credit Agreement
dated as of June 9, 2004 (as amended, modified or supplemented prior to the date
hereof, the "Credit Agreement"); and

      WHEREAS, the Borrower has requested that the Credit Agreement be amended
to modify the definition of Permitted Hedge Agreement as set forth herein; and

      WHEREAS, subject to the terms and conditions of this Amendment, the Banks
party hereto, the Agent and the LC Issuer have agreed to enter into this First
Amendment in order to effectuate such amendment and modification;

      NOW, THEREFORE, in consideration of the premises and for Ten Dollars
($10.00) and other good and valuable consideration received by each party
hereto, and each intending to be legally bound hereby, the parties agree as
follows:

      Section 1. Defined Terms. Except as amended hereby, terms used herein that
are defined in the Credit Agreement shall have the same meanings herein.

      Section 2. Amendments to Credit Agreement. The definition of "Permitted
Hedge Agreement" in Article I of the Credit Agreement is hereby amended and
restated in its entirety as follows:

      "Permitted Hedge Agreement" means any Hedge Agreement that Borrower enters
      into, together with any confirmations thereto, with respect to
      Hydrocarbons constituting in the aggregate, for all such Hedge Agreements,
      not more than seventy-five percent (75%) of the Proved Reserves that are
      (i) attributable to Borrower's interest in the Borrowing Base Oil and Gas
      Properties and (ii) projected to be produced during the term(s) of such
      Hedge Agreement(s).

      Section 3. Waiver of Credit Agreement Provision. The Agent, the LC Issuer
and each Bank hereby waives any breach of Section 6.11 of the Credit Agreement
(and any related Event of Default or Unmatured Event of Default), if any, that
has occurred, or may have

<PAGE>

occurred, as a result of the Borrower having entered into any Hedge Agreement
prior to the date hereof with a counterparty that has or had a credit rating
below "A-" from Standard and Poors or "A3" from Moody's Investment Service. The
foregoing waiver is limited precisely as written and shall not be deemed to be a
waiver or modification of any other term or condition of the Credit Agreement
and shall not prejudice any right or rights which the Banks may now have or may
have in the future under or in connection with the Credit Agreement or any other
Loan Document.

      Section 4. Conditions Precedent in Connection with the First Amendment.
The First Amendment shall become effective upon the satisfaction of each of the
following conditions precedent (the first date upon which each such condition
has been satisfied, herein the "Amendment Effective Date"):

            (a) Administrative Agent shall have received fully executed
      counterparts, in the number of multiple originals requested by
      Administrative Agent, of the First Amendment, duly executed by an
      authorized officer for Borrower and Banks constituting the Required Banks.

            (b) The representations and warranties contained in Article IV of
      the Credit Agreement shall be true and correct in all material respects on
      the date of the First Amendment (after giving effect to the provisions of
      this First Amendment) with the same effect as though such representations
      and warranties had been made on such date; and no Event of Default shall
      have occurred and be continuing or will have occurred upon the execution
      of the First Amendment (after giving effect to the provisions of this
      First Amendment).

            (c) All legal matters incident to the consummation of the
      transactions contemplated by the First Amendment shall be satisfactory to
      the Administrative Agent and its counsel.

      Section 5. Reaffirmation of Representations and Warranties. To induce the
Banks to enter into this First Amendment, the Borrower hereby reaffirms, as of
the date hereof, its representations and warranties contained in Article IV of
the Credit Agreement (after giving effect to the provisions of this First
Amendment) and in all other documents executed pursuant thereto, and
additionally represents and warrants that, after giving effect to the provisions
of this First Amendment:

            (a) The execution and delivery of this First Amendment and the
      performance by the Borrower of its obligations under this First Amendment
      are within the Borrower's power, have been duly authorized by all
      necessary corporate action, have received all necessary governmental
      approval (if any shall be required), and do not and will not contravene or
      conflict with any provision of law or of the charter or by-laws of the
      Borrower or of any agreement binding upon the Borrower.

            (b) The Credit Agreement as amended by this First Amendment
      represents the legal, valid and binding obligations of the Borrower,
      enforceable against the Borrower in accordance with their respective terms
      subject as to enforcement only to bankruptcy,

                                       2

<PAGE>

      insolvency, reorganization, moratorium or other similar laws affecting the
      enforcement of creditors' rights generally.

            (c) No Event of Default or Unmatured Event of Default has occurred
      and is continuing as of the date hereof.

      Section 6. Reaffirmation of Credit Agreement. This First Amendment shall
be deemed to be an amendment to the Credit Agreement, and the Credit Agreement,
as amended hereby, is hereby ratified, approved and confirmed in each and every
respect. All references to the Credit Agreement herein and in any other
document, instrument, agreement or writing shall hereafter be deemed to refer to
the Credit Agreement as amended hereby.

      Section 7. Entire Agreement. The Credit Agreement, as hereby amended,
embodies the entire agreement between the Borrower and the Banks and supersedes
all prior proposals, agreements and understandings relating to the subject
matter hereof. The Borrower certifies that it is not relying on any
representation, warranty, covenant or agreement except for those set forth in
the Credit Agreement, as hereby amended, and in the other documents previously
executed or executed of even date herewith.

      Section 8. Governing Law. THIS FIRST AMENDMENT SHALL BE GOVERNED BY AND
CONSTRUED IN ACCORDANCE WITH THE LAWS OF THE STATE OF TEXAS AND THE APPLICABLE
LAWS OF THE UNITED STATES OF AMERICA.

      Section 9. Severability. Whenever possible each provision of this First
Amendment shall be interpreted in such manner as to be effective and valid under
applicable law, but if any provision of this First Amendment shall be prohibited
by or invalid under applicable law, such provision shall be ineffective to the
extent of such prohibition or invalidity, without invalidating the remainder of
such provision or the remaining provisions of this First Amendment.

      Section 10. Execution in Counterparts. This First Amendment may be
executed in any number of counterparts and by the different parties on separate
counterparts, and each such counterpart shall be deemed to be an original, but
all such counterparts shall together constitute but one and the same agreement.

      Section 11. Section Captions. Section captions used in this First
Amendment are for convenience of reference only, and shall not affect the
construction of this First Amendment.

      Section 12. Successors and Assigns. This First Amendment shall be binding
upon the Borrower and the Banks and their respective successors and assigns, and
shall inure to the benefit of the Borrower and the Banks, and the respective
successors and assigns of the Banks.

      Section 13. Non-Application of Chapter 346 of Texas Finance Codes. In no
event shall Chapter 346 of the Texas Finance Code (which regulates certain
revolving loan accounts and revolving tri-party accounts) apply to the Credit
Agreement as amended hereby or any other Loan Documents or the transactions
contemplated hereby.

      Section 14. NOTICE. THIS FIRST AMENDMENT TOGETHER WITH THE CREDIT
AGREEMENT, AND THE OTHER LOAN DOCUMENTS REPRESENT THE

                                       3

<PAGE>

FINAL AGREEMENT BETWEEN THE PARTIES AND MAY NOT BE CONTRADICTED BY EVIDENCE OF
PRIOR, CONTEMPORANEOUS OR SUBSEQUENT ORAL AGREEMENTS OF THE PARTIES. THERE ARE
NO WRITTEN ORAL AGREEMENTS BETWEEN THE PARTIES.

                            [SIGNATURE PAGES FOLLOW]

                                       4

<PAGE>

IN WITNESS WHEREOF, the parties hereto have caused this First Amendment to be
duly executed as of the day and year first above written.

                                   BORROWER:

                                   ULTRA RESOURCES, INC.

                                   By: /s/ Michael D. Watford
                                       -----------------------------------------
                                   Name: Michael D. Watford
                                   Title: President and Chief Executive Officer

                                   ADMINISTRATIVE AGENT, LC ISSUER AND BANK:

                                   BANK ONE, NA

                                   By: /s/ Stephen Shatto
                                       -----------------------------------------
                                   Name: Stephen Shatto
                                   Title: Vice President

                                   SYNDICATION AGENT AND BANK:

                                   UNION BANK OF CALIFORNIA, N.A.

                                   By: /s/ ALI AHMED
                                       -----------------------------------------
                                   Name: ALI AHMED
                                   Title: VICE PRESIDENT

                                   By: /s/ Damien Meiburger
                                       -----------------------------------------
                                   Name: Damien Meiburger
                                   Title: Senior Vice President

                                   CO-AGENT AND BANK:

                                   HIBERNIA NATIONAL BANK

                                   By: /s/ Nancy G. Moragas
                                       -----------------------------------------
                                   Name: Nancy G. Moragas
                                   Title: Vice President

                                     S - 1

<PAGE>

                                   CO-AGENT AND BANK:

                                   GUARANTY BANK, FSB

                                   By: /s/ RICHARD MENCHACA
                                       -----------------------------------------
                                   Name: RICHARD MENCHACA
                                   Title: SENIOR VICE PRESIDENT

                                   BANK:

                                   COMPASS BANK

                                   By: /s/ Kathleen G. Bowen
                                       -----------------------------------------
                                   Name: Kathleen G. Bowen
                                   Title: Senior Vice President

                                   BANK:

                                   BANK OF SCOTLAND

                                   By: /s/ KAREN WORKMAN
                                       -----------------------------------------
                                   Name: KAREN WORKMAN
                                   Title: ASSISTANT VICE PRESIDENT

                                   BANK:

                                   FLEET NATIONAL BANK

                                   By: /s/ Michael J. Brochetti
                                       -----------------------------------------
                                   Name: Michael J. Brochetti
                                   Title: Director

                                     S - 2

<PAGE>

                          ACKNOWLEDGMENT BY GUARANTORS

      Each of the undersigned Guarantors hereby (i) consents to the terms and
conditions of that certain First Amendment to Second Amended and Restated Credit
Agreement dated as of August 10, 2004 (the "First Amendment"), (ii) acknowledges
and agrees that its consent is not required for the effectiveness of the First
Amendment, (iii) ratifies and acknowledges its respective Guaranteed
Indebtedness under each Loan Document to which it is a party, and (iv)
represents and warrants that (a) no Default or Event of Default has occurred and
is continuing, (b) it is in full compliance with all covenants and agreements
pertaining to it in the Loan Documents, and (c) it has reviewed a copy of the
First Amendment.

      Executed to be effective as of August 10, 2004.

                                   GUARANTORS:

                                   UP ENERGY CORPORATION
                                   ULTRA PETROLEUM CORP.

                                   By: /s/ Michael D. Watford
                                       -----------------------------------------
                                   Name: Michael D. Watford
                                   Title: President and Chief Executive Officer

                                     S - 3