<PAGE>
 
                                                                   EXHIBIT 10.22

                                                                       Execution


                      FIRST AMENDMENT TO CREDIT AGREEMENT

     THIS FIRST AMENDMENT TO CREDIT AGREEMENT (herein called this "Amendment")
is made as of the 8th day of July, 1998 by and among Western Gas Resources, Inc.
("Borrower") and NationsBank, N.A., successor by merger to NationsBank of Texas,
N.A., as Agent ("Agent"), and the Lenders referred to in the Original Agreement
(as defined below).

                              W I T N E S S E T H:

     WHEREAS, Borrower, Agent and Lenders have entered into that certain Credit
Agreement dated as of May 30, 1997 (as amended, restated, or supplemented to the
date hereof, the "Original Agreement"), for the purposes and consideration
therein expressed, pursuant to which Lenders made and became obligated to make
loans to Borrower as therein provided; and

     WHEREAS, Borrower, Agent and Lenders desire to amend the Original Agreement
to for the purposes set forth herein;

     NOW, THEREFORE, in consideration of the premises and the mutual covenants
and agreements contained herein and in the Original Agreement, in consideration
of the loans which may hereafter be made by Lenders to Borrower, and for other
good and valuable consideration, the receipt and sufficiency of which are hereby
acknowledged, the parties hereto do hereby agree as follows:

                                   ARTICLE I.

                           Definitions and References
                           --------------------------

     (S) 1.1  Terms Defined in the Original Agreement.  Unless the context
              ---------------------------------------                     
otherwise requires or unless otherwise expressly defined herein, the terms
defined in the Original Agreement shall have the same meanings whenever used in
this Amendment.


                                 ARTICLE II.

                                   Amendments
                                   ----------

     (S) 2.2  Defined Terms.  Section 1.1 of the Original Agreement is hereby
              -------------                                                  
amended by adding the following defined terms:

          "'Granger Complex' means those certain gas processing facilities and
            ----------------                                                  
     associated gas gathering systems (with all related assets) to be sold by
     Borrower to RIS Resources (USA) Inc. pursuant to the Granger Option and
     Asset Purchase Agreement."
<PAGE>
 
          "'Granger Option and Asset Purchase Agreement' means that certain
            -------------------------------------------                    
     Option and Asset Purchase Agreement dated November 14, 1997 by and between
     Mountain Gas Resources, Inc., Borrower and RIS Resources (USA) Inc., as
     amended.

     (S) 2.2  Limitation on Sales of Property.  Section 6.2(d) of the Original
              -------------------------------                                 
Agreement is hereby amended to read in its entirety as follows:

     "Limitation on Sales of Property.  No Related Person will sell, transfer,
      -------------------------------                                         
lease, exchange, alienate or dispose of any of its material assets or properties
or any material interest therein except:

               (i)   equipment which is worthless or obsolete or which is
          replaced by equipment of equal suitability and value;

               (ii)  inventory which is sold in the ordinary course of business;

               (iii) sales of receivables pursuant to a Permitted Receivables
          Purchase Facility;

               (iv)  the sale of up to an undivided fifty percent (50%) interest
          in the Granger Complex pursuant to the Granger Option and Asset
          Purchase Agreement; and

               (v)   so long as no Default or Event of Default has occurred,
          other assets or property which are sold in arm's length transactions
          to third parties that are not Affiliates of Borrower and are sold for
          fair consideration not in the aggregate in excess of $20,000,000
          during any Fiscal Year; provided that the sale of the Granger Complex
          and related assets pursuant to the Granger Option and Asset Purchase
          Agreement shall not be included in the calculation of this clause (v).

     Neither Borrower nor any of Borrower's Subsidiaries will sell, transfer or
     otherwise dispose of capital stock of any of Borrower's Subsidiaries except
     that any Subsidiary of Borrower may sell or issue its own capital stock to
     the extent not otherwise prohibited hereunder.  No Related Person will
     discount, sell, pledge or assign any notes payable to it, accounts
     receivable or future income except to the extent expressly permitted under
     the Loan Documents."

     (S) 2.3  Limitation on Investments and New Businesses  Section 6.2(f)(iii)
              --------------------------------------------                     
of the Original Agreement is hereby amended to read in its entirety as follows:

               "(iii)  make any acquisitions of or capital contributions to or
          other investments except (A) capital contributions to and investments
          in Williston Gas Company and Subsidiaries already wholly owned by such
          Related Person and the joint ventures described on Schedule 4 hereto,
          (B) deposits with any Lender, investments in obligations of any Lender
          or any of such Lender's Affiliates, time 

                                      -2-
<PAGE>
 
          deposits in other banking institutions which, at the time such deposit
          is made, are rated "C" by Thomson BankWatch, Inc. and investments
          maturing within one year from the date of acquisition in direct
          obligations of or obligations supported by, the full faith and credit
          of, the United States of America, (C) purchases of open market
          commercial paper, maturing within 270 days after acquisition thereof,
          with the highest or second highest credit rating given by either
          Standard & Poor's Rating Group (a division of McGraw-Hill, Inc.) or
          Moody's Investors Services, Inc. and investments in money market
          mutual funds with equivalent ratings, or (D) preferred stock of RIS
          Resources (USA) Inc. in an amount not to exceed $14,000,000 received
          in connection with the sale of the Granger Complex and related assets
          described in Section 6.2;"


                                  ARTICLE III.

                          Conditions of Effectiveness
                          ---------------------------

     (S) 3.1.  Effective Date.  This Amendment shall become effective as of the
               --------------                                                  
date first above written when, and only when, Agent shall have received all of
the following documents:

          (a) This Amendment, duly authorized, executed and delivered, and in
     form and substance satisfactory to Agent.

          (b) A certificate of a duly authorized officer of Borrower to the
     effect that all of the representations and warranties set forth in Article
     IV hereof are true and correct at and as of the time of such effectiveness.

          (c) A certificate of the Secretary of Borrower dated the date of this
     Amendment certifying that attached thereto is a true and complete copy of
     resolutions adopted by the Board of Directors of Borrower authorizing the
     execution, delivery and performance of this Amendment and certifying the
     names and true signatures of the officers of Borrower authorized to sign
     this Amendment.

          (d) Such supporting documents as Agent may reasonably request.


                                  ARTICLE IV.

                         Representations and Warranties
                         ------------------------------

     (S) 4.1.  Representations and Warranties of Borrower.  In order to induce
               ------------------------------------------                     
each Lender to enter into this Amendment, Borrower represents and warrants to
each Lender that:

          (a) The representations and warranties contained in Section 5.1 of the
     Original Agreement are true and correct at and as of the time of the
     effectiveness hereof (except as 

                                      -3-
<PAGE>
 
     such representations and warranties have been modified by the transactions
     contemplated herein).

          (b) Borrower is duly authorized to execute and deliver this Amendment
     and Borrower is and will continue to be duly authorized to borrow monies
     and to perform its obligations under the Credit Agreement. Borrower has
     duly taken all corporate and action necessary to authorize the execution
     and delivery of this Amendment.

          (c) The execution and delivery by Borrower of this Amendment, the
     performance of its obligations thereunder and the consummation of the
     transactions contemplated hereby do not and will not conflict with any
     provision of law, statute, rule or regulation or of the certificate of
     incorporation and bylaws of Borrower or of any material agreement,
     judgment, license, order or permit applicable to or binding upon Borrower
     or result in the creation of any lien, charge or encumbrance upon any
     assets or properties of Borrower.  Except for those which have been
     obtained, no consent, approval, authorization or order of any court or
     governmental authority or third party is required in connection with the
     execution and delivery by Borrower and of this Amendment.

          (d) When duly executed and delivered, this Amendment and the Credit
     Agreement will be a legal and binding obligation of Borrower enforceable in
     accordance with its terms, except as limited by bankruptcy, insolvency or
     similar laws of general application relating to the enforcement of
     creditors' rights and by equitable principles of general application.

          (e) The unaudited Consolidated quarterly financial statements of
     Borrower dated as of March 31, 1998 fairly present the Consolidated
     financial position at such date and the Consolidated statement of
     operations and the changes in Consolidated financial position for the
     periods ending on such date for Borrower.  Copies of such financial
     statements have heretofore been delivered to Agent.  Since March 31, 1998,
     no material adverse change has occurred in the financial condition or
     business or in the Consolidated financial condition or business of
     Borrower.


                                   ARTICLE V.

                                 Miscellaneous
                                 -------------

     (S) 5.1.  Ratification of Agreements.  The Original Agreement as hereby
               --------------------------                                   
amended is hereby ratified and confirmed in all respects.  Any reference to the
Credit Agreement in any Loan Document shall be deemed to be a reference to the
Original Agreement as hereby amended.  The Loan Documents, as they may be
amended or affected by the various Amendment Documents, are hereby ratified and
confirmed in all respects.  The execution, delivery and effectiveness of this
Amendment and the other Amendment Documents shall not, except as expressly
provided herein or therein, operate as a waiver of any right, power or remedy of
Lenders under the Credit 

                                      -4-
<PAGE>
 
Agreement, the Notes, or any other Loan Document nor constitute a waiver of any
provision of the Credit Agreement, the Notes or any other Loan Document.

     (S) 5.2.  Survival of Agreements.  All representations, warranties,
               ----------------------                                   
covenants and agreements of Borrower herein shall survive the execution and
delivery of this Amendment and the performance hereof, including without
limitation the making or granting of the Loans, and shall further survive until
all of the Obligations are paid in full.  All statements and agreements
contained in any certificate or instrument delivered by Borrower hereunder or
under the Credit Agreement to any Lender shall be deemed to constitute
representations and warranties by, and/or agreements and covenants of, Borrower
under this Amendment and under the Credit Agreement.

     (S) 5.3.  Loan Documents.  This Amendment and each other Amendment Document
               --------------                                                   
is a Loan Document, and all provisions in the Credit Agreement pertaining to
Loan Documents apply hereto and thereto.

     (S) 5.4.  Governing Law.  This Amendment shall be governed by and construed
               -------------                                                    
in accordance the laws of the State of Texas and any applicable laws of the
United States of America in all respects, including construction, validity and
performance.

     (S) 5.5.  Counterparts.  This Amendment may be separately executed in
               ------------                                               
counterparts and by the different parties hereto in separate counterparts, each
of which when so executed shall be deemed to constitute one and the same
Amendment.

     THIS AMENDMENT AND THE OTHER LOAN DOCUMENTS REPRESENT THE 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
UNWRITTEN ORAL AGREEMENTS OF THE PARTIES.

                                      -5-
<PAGE>
 
     IN WITNESS WHEREOF, this Amendment is executed as of the date first above
written.


                              WESTERN GAS RESOURCES, INC.
 

                              By: /s/ William J. Krysiak
                                 ---------------------------------------
                                 Name: William J. Krysiak
                                 Title: Vice President - Finance

 
                              NATIONSBANK, N.A.


                              By: /s/ David C. Rubinking
                                 ---------------------------------------
                                 Name: David C. Rubinking
                                 Title: Senior Vice President

 
                              BANK OF AMERICA NATIONAL TRUST
                              AND SAVINGS ASSOCIATION


                              By: /s/ Paul Colon
                                 ---------------------------------------
                                 Name: Paul Colon
                                 Title: Vice President


                              BANK OF MONTREAL


                              By: /s/ Cahal B. Carmody
                                 ---------------------------------------
                                 Name: Cahal B. Carmody
                                 Title: Director


                              BANKBOSTON, N.A.
 

                              By: /s/ Terrance Ronon
                                 ---------------------------------------
                                 Name: Terrance Ronon
                                 Title: Vice President
<PAGE>
 
                              CREDIT LYONNAIS NEW YORK BRANCH


                              By: /s/ Philippe Soustra
                                 ----------------------------------------
                                 Name: Philippe Soustra
                                 Title: Senior Vice President


                              CIBC INC.


                              By: /s/ M.A. G. Corkum
                                 ----------------------------------------
                                 Name: Michael A. G. Corkum
                                 Title: Authorized Signatory
 

                              U.S. BANK NATIONAL ASSOCIATION


                              By: /s/ Monte E. Deckerd
                                 ----------------------------------------
                                 Name: Monte E. Deckerd
                                 Title: Vice President


                              SOCIETE GENERALE, SOUTHWEST AGENCY


                              By: /s/ R.A. Erbert
                                 ----------------------------------------
                                 Name: Richard A. Erbert
                                 Title: Vice President


                              ABN AMRO BANK N.V.


                              By: /s/ Scott Albert
                                 ----------------------------------------
                                 Name: Scott Albert
                                 Title: Vice President


                              By: /s/ Darin P. Fischer
                                 ----------------------------------------
                                 Name:  Darin P. Fischer
                                 Title Assistant Vice President