Exhibit 10.4

First Amendment

to

Second Amended and Restated Credit Agreement

Among

Linn Energy, LLC

as Borrower,

BNP Paribas,

as Administrative Agent,

and

The Lenders Signatory Hereto

Effective as of February 1, 2007

--------------------------------------------------------------------------------

FIRST AMENDMENT TO SECOND AMENDED AND RESTATED CREDIT AGREEMENT

This First Amendment to Second Amended and Restated Credit Agreement (this
“First Amendment”) executed effective as of the 1st of February, 2007 (the
“First Amendment Effective Date”) is among Linn Energy, LLC, a limited liability
company formed under the laws of the State of Delaware (the “Borrower”); each of
the undersigned guarantors (the “Guarantors”, and together with the Borrower,
the “Obligors”); each of the Lenders that is a signatory hereto; and BNP
Paribas, as administrative agent for the Lenders (in such capacity, together
with its successors, the “Administrative Agent”).

Recitals

A.                                   The Borrower, the Administrative Agent and
the Lenders are parties to that certain Second Amended and Restated Credit
Agreement dated as of August 1, 2006 (the “Credit Agreement”), pursuant to which
the Lenders have made certain credit available to and on behalf of the Borrower.

B.                                     The Borrower has requested and the
Administrative Agent and the Lenders have agreed to amend certain provisions of
the Credit Agreement.

C.                                     The Borrower is anticipating acquiring
additional Oil and Gas Properties (the “Stallion Acquisition Properties”)
pursuant to two Purchase and Sale Agreement with Cavello Energy, LLC (which
together with all bills of sale, assignments, agreements, instruments and
documents executed and delivered in connection therewith, as amended, the
“Stallion Acquisition Documents”) (the “Stallion Acquisition”).

D.                                    NOW, THEREFORE, in consideration of the
premises and the mutual covenants herein contained, for good and valuable
consideration, the receipt and sufficiency of which are hereby acknowledged, the
parties hereto agree as follows:

Section 1.                                            Defined Terms.  Each
capitalized term which is defined in the Credit Agreement, but which is not
defined in this First Amendment, shall have the meaning ascribed such term in
the Credit Agreement.  Unless otherwise indicated, all section references in
this First Amendment refer to the Credit Agreement.

Section 2.                                            Amendments to Credit
Agreement.

2.1                                 Definitions.  Section 1.02 is hereby amended
by amending and restated the definition of “Agreement” as follows:

“ ‘Agreement’ means this Second Amended and Restated Credit Agreement, as
amended by that certain First Amendment to Second Amended and Restated Credit
Agreement, dated as of February 1, 2007, and as the same may from time to time
be further amended, modified, supplemented or restated.”

2

--------------------------------------------------------------------------------

2.2                                 Section 9.02.  Section 9.02(g) is hereby
amended and restated in its entirety as follows:

“(g)                           other Debt not to exceed $40,000,000 in the
aggregate at any one time.”

2.3                                 Annex I.  Annex I is hereby amended and
restated in its entirety as set forth on the attached Annex I.

Section 3.                                            Additional Lenders.  For
an agreed consideration, the current Lenders (including the Administrative Agent
in its capacity as a Lender) hereby collectively irrevocably sell and assign to
each of BMO Capital Markets Financing, Inc., JPMorgan Chase Bank, N.A., Deutsche
Bank Trust Company Americas, Wachovia Bank, National Association, Allied Irish
Bank, p.l.c., U.S. Bank National Association and Amegy Bank National Association
(collectively, the “New Lenders”), and the New Lenders, by their signature
hereto, hereby irrevocably purchase and assume from such Lenders, subject to and
in accordance with the Credit Agreement, as of the First Amendment Effective
Date (i) the rights and obligations of the Lenders under the Credit Agreement
and any other documents or instruments delivered pursuant thereto, such that the
outstanding Maximum Credit Amount and Applicable Percentage of each Lender
(including the New Lenders) are in the amounts set forth on Annex I attached
hereto and (ii) to the extent permitted to be assigned under applicable law, all
claims, suits, causes of action and any other right of the assigning Lenders
against any Person, whether known or unknown, arising under or in connection
with the Credit Agreement, any other documents or instruments delivered pursuant
thereto or the loan transactions governed thereby or in any way based on or
related to any of the foregoing, including contract claims, tort claims,
malpractice claims, statutory claims and all other claims at law or in equity
related to the rights and obligations sold and assigned pursuant to clause (i)
above.

Section 4.                                            Scheduled Redetermination
of the Borrowing Base.  Pursuant to a Scheduled Redetermination pursuant to
Section 2.07(b), the Borrowing Base shall be increased to 725,000,000, effective
from and including the First Amendment Effective Date to but excluding the next
Redetermination Date.  Notwithstanding the foregoing, the Borrowing Base may be
subject to further adjustments from time to time pursuant to Section 8.13 or
Section 9.12.

Section 5.                                            Conditions Precedent.  The
effectiveness of this First Amendment is subject to the receipt by the
Administrative Agent of the following documents and satisfaction of the other
conditions provided in this Section 5, each of which shall be reasonably
satisfactory to the Administrative Agent in form and substance:

5.1                                 Payment by the Borrower to the
Administrative Agent of all fees and other amounts due and payable on or prior
to the First Amendment Effective Date, including, to the extent invoiced,
reimbursement or payment of all out-of-pocket expenses required to be reimbursed
or paid by the Borrower.

5.2                                 The Administrative Agent shall have received
multiple counterparts as requested of the this First Amendment from each Lender.

3

--------------------------------------------------------------------------------

5.3                                 The Administrative Agent shall have received
duly executed Notes payable to the order of each Lender (including the New
Lenders) in a principal amount equal to its Maximum Credit Amount dated as of
the date hereof.

5.4                                 The Administrative Agent shall have received
(a) a certificate of a Responsible Officer of the Borrower certifying:  (i) that
the Borrower is concurrently consummating the Stallion Acquisition in accordance
with the terms of the Stallion Acquisition Documents (with all of the material
conditions precedent thereto having been satisfied in all material respects by
the parties thereto) and acquiring substantially all of the Stallion Acquisition
Properties contemplated by the Stallion Acquisition Documents; (ii) as to the
final purchase price for the Stallion Acquisition Properties after giving effect
to all adjustments as of the closing date contemplated by the Stallion
Acquisition Documents and specifying, by category, the amount of such
adjustment; (iii) that attached thereto is a true and complete list of the
Stallion Acquisition Properties which have been excluded from the Stallion
Acquisition pursuant to the terms of the Acquisition Documents, specifying with
respect thereto the basis of exclusion as (A) title defect, (B) preferential
purchase right, (C) environmental or (D) casualty loss; (iv) that attached
thereto is a true and complete list of all Stallion Acquisition Properties for
which any seller has elected to cure a title defect, (v) that attached thereto
is a true and complete list of all Stallion Acquisition Properties for which any
seller has elected to remediate an adverse environmental condition, and (vi)
that attached thereto is a true and complete list of all Stallion Acquisition
Properties which are currently pending final decision by a third party regarding
purchase of such property in accordance with any preferential right; (x) a true
and complete executed copy of each of the Stallion Acquisition Documents; (y)
original counterparts or copies, certified as true and complete, of the
assignments, deeds and leases for all of the Stallion Acquisition Properties;
and (b) such other related documents and information as the Administrative Agent
shall have reasonably requested.

5.5                                 The Administrative Agent shall have received
from each party thereto duly executed counterparts (in such number as may be
requested by the Administrative Agent) of the Security Instrument described on
Exhibit A.  In connection with the execution and delivery of the Security
Instruments, the Administrative Agent shall be reasonably satisfied that the
Security Instruments create first priority, perfected Liens (subject only to
Excepted Liens identified in clauses (a) to (d) and (f) of the definition
thereof, but subject to the provisos at the end of such definition) on at least
80% of the total value of the Stallion Acquisition Properties.

5.6                                 The Administrative Agent shall have received
an opinion of local counsel in each of the following states: Texas and any other
jurisdictions requested by the Administrative Agent, in form and substance
satisfactory to the Administrative Agent.

5.7                                 The Administrative Agent shall have received
title information as the Administrative Agent may reasonably require
satisfactory to the Administrative Agent setting forth the status of title to at
least 80% of the total value of the Stallion Acquisition Properties.

5.8                                 The Administrative Agent shall be reasonably
satisfied with the environmental condition of the Stallion Acquisition
Properties.

4

--------------------------------------------------------------------------------

5.9                                 The Administrative Agent shall have received
a Reserve Report covering the Stallion Acquisition Properties.

5.10                           The Administrative Agent shall have received a
certificate of a Responsible Officer certifying that the Borrower has received
all consents and approvals required by Section 7.03 in connection with the
Stallion Acquisition.

5.11                           The Administrative Agent shall have received
evidence satisfactory to it that all Liens associated with the Stallion
Acquisition Properties have been released or terminated contemporaneously with
the Stallion Acquisition and that arrangements satisfactory to the
Administrative Agent have been made for recording and filing of such releases.

5.12                           The Administrative Agent shall have received such
other documents as the Administrative Agent or special counsel to the
Administrative Agent may reasonably request.

5.13                           The Administrative Agent shall have received a
certificate of a Responsible Officer of the Borrower certifying that the
Borrower has received or is receiving concurrently with the Stallion
Acquisition, at least $300,000,000 from the sale of its Equity Interests.

5.14                           No Default or Event of Default shall have
occurred and be continuing as of the First Amendment Effective Date.

Section 6.                                            Representations and
Warranties; Etc.  Each Obligor hereby affirms:  (a) that as of the date of
execution and delivery of this First Amendment, all of the representations and
warranties contained in each Loan Document to which such Obligor is a party are
true and correct in all material respects as though made on and as of the First
Amendment Effective Date (unless made as of a specific earlier date, in which
case, was true as of such date); and (b) that after giving effect to this First
Amendment and to the transactions contemplated hereby, no Defaults exist under
the Loan Documents or will exist under the Loan Documents.

Section 7.                                            Miscellaneous.

7.1                                 Confirmation.  The provisions of the Credit
Agreement (as amended by this First Amendment) shall remain in full force and
effect in accordance with its terms following the effectiveness of this First
Amendment.

7.2                                 Ratification and Affirmation of Obligors. 
Each of the Obligors hereby expressly (i) acknowledges the terms of this First
Amendment, (ii) ratifies and affirms its obligations under the Guarantee
Agreement and the other Security Instruments to which it is a party, (iii)
acknowledges, renews and extends its continued liability under the Guarantee
Agreement and the other Security Instruments to which it is a party and agrees
that its guarantee under the Guarantee Agreement and the other Security
Instruments to which it is a party remains in full force and effect with respect
to the Indebtedness as amended hereby.

7.3                                 Counterparts.  This First Amendment may be
executed by one or more of the parties hereto in any number of separate
counterparts, and all of such counterparts taken together shall be deemed to
constitute one and the same instrument.

5

--------------------------------------------------------------------------------

7.4                                 No Oral Agreement.  This written First
Amendment, the Credit Agreement and the other Loan Documents executed in
connection herewith and therewith represent the final agreement between the
parties and may not be contradicted by evidence of prior, contemporaneous, or
unwritten oral agreements of the parties.  There are no subsequent oral
agreements between the parties.

7.5                                 Governing Law.  This First Amendment
(including, but not limited to, the validity and enforceability hereof) shall be
governed by, and construed in accordance with, the laws of the State of Texas.

6

--------------------------------------------------------------------------------

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

BORROWER:

LINN ENERGY, LLC

 

 

 

 

By:

/s/Kolja Rockov

 

 

 

Kolja Rockov, Executive Vice President
and Chief Financial Officer

 

1

--------------------------------------------------------------------------------

 

GUARANTORS:

LINN ENERGY HOLDINGS, LLC

 

 

 

LINN OPERATING, INC.

 

 

 

PENN WEST PIPELINE, LLC

 

 

 

PENN WEST STORAGE, LLC

 

 

 

MID ATLANTIC WELL SERVICE,
INC.

 

 

 

LINN WESTERN OPERATING, INC.

 

 

 

LINN WESTERN PROCESSING, LLC

 

 

 

LINN MID-CONTINENT OPERATING,
INC.

 

 

 

 

 

 

 

By:

/s/Kolja Rockov

 

 

 

Kolja Rockov
Executive Vice President and Chief
Financial Officer

 

2

--------------------------------------------------------------------------------

 

ADMINISTRATIVE AGENT:

BNP PARIBAS,

 

as Administrative Agent and Lender

 

 

 

 

 

 

 

By:

/s/ Douglas R. Litman

 

 

Name:

Douglas R. Litman

 

Title:

Managing Director

 

 

 

 

 

 

 

By:

/s/ Betsy Jocher

 

 

Name:

Betsy Jocher

 

Title:

Director

 

3

--------------------------------------------------------------------------------

 

LENDERS:

ROYAL BANK OF CANADA, as a Syndication
Agent and a Lender

 

 

 

 

By:

/s/ Don J. McKinnerney

 

 

Name:

Don J. McKinnerney

 

Title:

Authorized Signatory

 

4

--------------------------------------------------------------------------------

 

SOCIETE GENERALE, as a Syndication Agent
and a Lender

 

 

 

 

By:

/s/ Graeme R. Bullen

 

 

Name:

Graeme R. Bullen

 

Title:

Director

 

5

--------------------------------------------------------------------------------

 

COMERICA BANK, as a Documentation Agent
and a Lender

 

 

 

 

By:

/s/ Huma Vadgama

 

 

Name:

Huma Vadgama

 

Title:

Vice President

 

6

--------------------------------------------------------------------------------

 

CITIBANK, N.A., as a Documentation Agent
and a Lender

 

 

 

 

By:

/s/ Thomas Benavidos

 

 

Name:

Thomas Benavidos

 

Title:

Vice President

 

7

--------------------------------------------------------------------------------

 

KEYBANK NATIONAL ASSOCIATION, as a
Lender

 

 

 

 

By:

/s/ Thomas Rajan

 

 

Name:

Thomas Rajan

 

Title:

Senior Vice President

 

8

--------------------------------------------------------------------------------

 

FORTIS CAPITAL CORP., as a Lender

 

 

 

 

By:

/s/ David Montgomery

 

 

Name:

David Montgomery

 

Title:

Senior Vice President

 

 

By:

/s/ Darrell Holley

 

 

Name:

Darrell Holley

 

Title:

Managing Director

 

9

--------------------------------------------------------------------------------

 

LEHMAN COMMERICAL PAPER INC., as a
Lender

 

 

 

 

By:

/s/ Diane Albanese

 

 

Name:

Diane Albanese

 

Title:

Authorized Signatory

 

10

--------------------------------------------------------------------------------

 

NEW LENDERS:

BMO Capital Markets Financing, Inc., as a Lender

 

 

 

 

By:

/s/ James V. Ducote

 

 

Name:

James V. Ducote

 

Title:

Director

 

11

--------------------------------------------------------------------------------

 

JPMORGAN CHASE BANK, N.A., as a Lender

 

 

 

 

By:

/s/ Jo Linda Papadakis

 

 

Name:

Jo Linda Papadakis

 

Title:

Vice President

 

12

--------------------------------------------------------------------------------

 

Deutsche Bank Trust Company
Americas, as a Lender

 

 

 

 

By:

/s/ Evelyn Thierry

 

 

Name:

Evelyn Thierry

 

Title:

Vice President

 

 

 

 

By:

/s/ Carin Keegan

 

 

Name:

Carin Keegan

 

Title:

Vice President

 

13

--------------------------------------------------------------------------------

 

WACHOVIA BANK, NATIONAL
ASSOCIATION, as a Lender

 

 

 

 

By:

/s/ Chris Hewitt

 

 

Name:

Chris Hewitt

 

Title:

Vice President

 

14

--------------------------------------------------------------------------------

 

ALLIED IRISH BANK, p.l.c., as a Lender

 

 

 

 

By:

/s/ David O’Driscoll

 

 

Name:

David O’Driscoll

 

Title:

Assistant Vice President

 

 

 

 

By:

/s/ Vaughn Buck

 

 

Name:

Vaughn Buck

 

Title:

Director

 

15

--------------------------------------------------------------------------------

 

U.S. BANK NATIONAL ASSOCIATION, as a
Lender

 

 

 

 

By:

/s/ Justin M. Alexander

 

 

Name:

Justin M. Alexander

 

Title:

Vice President

 

16

--------------------------------------------------------------------------------

 

AMEGY BANK NATIONAL ASSOCIATION,
as a Lender

 

 

 

 

By:

/s/ W. Bryan Chapman

 

 

Name:

W. Bryan Chapman

 

Title:

Senior Vice President

 

17

--------------------------------------------------------------------------------

ANNEX I
LIST OF MAXIMUM CREDIT AMOUNTS

Aggregate Maximum Credit Amounts

Name of Lender

 

Applicable Percentage

 

Maximum Credit Amount

 

BNP Paribas

 

10.34

%

$

82,758,620.69

 

Royal Bank of Canada

 

10.34

%

$

82,758,620.69

 

Societe Generale

 

9.66

%

$

77,241,379.31

 

BMO Capital Markets Financing, Inc.

 

8.97

%

$

71,724,137.93

 

JPMorgan Chase Bank, N.A.

 

8.97

%

$

71,724,137.93

 

Citibank, N.A.

 

8.97

%

$

71,724,137.93

 

Comerica Bank

 

6.90

%

$

55,172,413.79

 

Deutsche Bank Trust Company Americas

 

6.90

%

$

55,172,413.79

 

KeyBank National Association

 

6.90

%

$

55,172,413.79

 

Wachovia Bank, National Association

 

6.90

%

$

55,172,413.79

 

Fortis Capital Corp.

 

3.45

%

$

27,586,206.90

 

Allied Irish Bank, p.l.c.

 

3.45

%

$

27,586,206.90

 

U.S. Bank National Association

 

3.45

%

$

27,586,206.90

 

Amegy Bank National Association

 

3.45

%

$

27,586,206.90

 

Lehman Commercial Paper Inc.

 

1.38

%

$

11,034,482.76

 

TOTAL

 

100

%

$

800,000,000.00

 

 

First Amendment
Annex I

--------------------------------------------------------------------------------

EXHIBIT A

Security Instruments

1.                                       Deed of Trust, Fixture Filing,
Assignment of As-Extracted Collateral, Security Agreement and Financing
Statement from Linn Energy Holdings, LLC in favor of BNP Paribas, as
Administrative Agent, filed in various Texas counties.

2.                                       UCC-1 in connection with item 1.

3.                                       Deed of Trust, Fixture Filing,
Assignment of As-Extracted Collateral, Security Agreement and Financing
Statement from Penn West Pipeline, LLC in favor of BNP Paribas, as
Administrative Agent, filed in various Texas counties.

4.                                       UCC-1 in connection with item 3.

First Amendment
Exhibit A

--------------------------------------------------------------------------------