<?xml version="1.0"?>
<ownershipDocument>

    <schemaVersion>X0508</schemaVersion>

    <documentType>4</documentType>

    <periodOfReport>2026-01-14</periodOfReport>

    <issuer>
        <issuerCik>0000836147</issuerCik>
        <issuerName>MIDDLEFIELD BANC CORP</issuerName>
        <issuerTradingSymbol>MBCN</issuerTradingSymbol>
    </issuer>

    <reportingOwner>
        <reportingOwnerId>
            <rptOwnerCik>0002007962</rptOwnerCik>
            <rptOwnerName>Cheravitch Michael L</rptOwnerName>
        </reportingOwnerId>
        <reportingOwnerAddress>
            <rptOwnerStreet1>15985 EAST HIGH STREET</rptOwnerStreet1>
            <rptOwnerStreet2></rptOwnerStreet2>
            <rptOwnerCity>MIDDLEFIELD</rptOwnerCity>
            <rptOwnerState>OH</rptOwnerState>
            <rptOwnerZipCode>44062</rptOwnerZipCode>
            <rptOwnerStateDescription></rptOwnerStateDescription>
        </reportingOwnerAddress>
        <reportingOwnerRelationship>
            <isOfficer>1</isOfficer>
            <officerTitle>EVP-Chief Banking Officer</officerTitle>
        </reportingOwnerRelationship>
    </reportingOwner>

    <aff10b5One>0</aff10b5One>

    <nonDerivativeTable>
        <nonDerivativeTransaction>
            <securityTitle>
                <value>Common Stock</value>
            </securityTitle>
            <transactionDate>
                <value>2026-01-14</value>
            </transactionDate>
            <transactionCoding>
                <transactionFormType>4</transactionFormType>
                <transactionCode>A</transactionCode>
                <equitySwapInvolved>0</equitySwapInvolved>
                <footnoteId id="F1"/>
            </transactionCoding>
            <transactionAmounts>
                <transactionShares>
                    <value>876</value>
                </transactionShares>
                <transactionPricePerShare>
                    <value>34.50</value>
                </transactionPricePerShare>
                <transactionAcquiredDisposedCode>
                    <value>A</value>
                </transactionAcquiredDisposedCode>
            </transactionAmounts>
            <postTransactionAmounts>
                <sharesOwnedFollowingTransaction>
                    <value>6801</value>
                </sharesOwnedFollowingTransaction>
            </postTransactionAmounts>
            <ownershipNature>
                <directOrIndirectOwnership>
                    <value>D</value>
                </directOrIndirectOwnership>
            </ownershipNature>
        </nonDerivativeTransaction>
        <nonDerivativeTransaction>
            <securityTitle>
                <value>Common Stock</value>
            </securityTitle>
            <transactionDate>
                <value>2026-01-14</value>
            </transactionDate>
            <transactionCoding>
                <transactionFormType>4</transactionFormType>
                <transactionCode>F</transactionCode>
                <equitySwapInvolved>0</equitySwapInvolved>
            </transactionCoding>
            <transactionAmounts>
                <transactionShares>
                    <value>301</value>
                </transactionShares>
                <transactionPricePerShare>
                    <value>34.50</value>
                </transactionPricePerShare>
                <transactionAcquiredDisposedCode>
                    <value>D</value>
                </transactionAcquiredDisposedCode>
            </transactionAmounts>
            <postTransactionAmounts>
                <sharesOwnedFollowingTransaction>
                    <value>6500</value>
                </sharesOwnedFollowingTransaction>
            </postTransactionAmounts>
            <ownershipNature>
                <directOrIndirectOwnership>
                    <value>D</value>
                </directOrIndirectOwnership>
            </ownershipNature>
        </nonDerivativeTransaction>
    </nonDerivativeTable>

    <derivativeTable>
        <derivativeHolding>
            <securityTitle>
                <value>Conditional Stock Award</value>
                <footnoteId id="F2"/>
            </securityTitle>
            <conversionOrExercisePrice>
                <footnoteId id="F4"/>
            </conversionOrExercisePrice>
            <exerciseDate>
                <footnoteId id="F2"/>
            </exerciseDate>
            <expirationDate>
                <value>2027-09-06</value>
            </expirationDate>
            <underlyingSecurity>
                <underlyingSecurityTitle>
                    <value>Common Stock</value>
                </underlyingSecurityTitle>
                <underlyingSecurityShares>
                    <value>1708</value>
                </underlyingSecurityShares>
            </underlyingSecurity>
            <postTransactionAmounts>
                <sharesOwnedFollowingTransaction>
                    <value>1708</value>
                </sharesOwnedFollowingTransaction>
            </postTransactionAmounts>
            <ownershipNature>
                <directOrIndirectOwnership>
                    <value>D</value>
                </directOrIndirectOwnership>
            </ownershipNature>
        </derivativeHolding>
        <derivativeHolding>
            <securityTitle>
                <value>Conditional Stock Award</value>
                <footnoteId id="F3"/>
            </securityTitle>
            <conversionOrExercisePrice>
                <footnoteId id="F4"/>
            </conversionOrExercisePrice>
            <exerciseDate>
                <footnoteId id="F3"/>
            </exerciseDate>
            <expirationDate>
                <value>2028-01-14</value>
            </expirationDate>
            <underlyingSecurity>
                <underlyingSecurityTitle>
                    <value>Common Stock</value>
                </underlyingSecurityTitle>
                <underlyingSecurityShares>
                    <value>1754</value>
                </underlyingSecurityShares>
            </underlyingSecurity>
            <postTransactionAmounts>
                <sharesOwnedFollowingTransaction>
                    <value>1754</value>
                </sharesOwnedFollowingTransaction>
            </postTransactionAmounts>
            <ownershipNature>
                <directOrIndirectOwnership>
                    <value>D</value>
                </directOrIndirectOwnership>
            </ownershipNature>
        </derivativeHolding>
    </derivativeTable>

    <footnotes>
        <footnote id="F1">The acquisition represents the vesting of restricted stock granted to the reporting person on January 14, 2025. The shares vested on the first anniversary of the grant.</footnote>
        <footnote id="F2">The award represents a grant of restricted stock which vests ratably over a three-year period provided that Mr. Cheravitch remains continuously employed by Middlefield as of each vesting date. Until the award vests, the award confers no right to vote, no right to dividends, and no other shareholder rights to the recipient. The vesting details may be found on a Form 8-K filed September 4, 2024.</footnote>
        <footnote id="F3">The award represents a grant of restricted stock which vests ratably over a three-year period provided that Mr. Cheravitch remains continuously employed by Middlefield as of each vesting date. Until the award vests, the award confers no right to vote, no right to dividends, and no other shareholder rights to the recipient. The vesting details may be found on a Form 8-K filed January 17, 2025.</footnote>
        <footnote id="F4">Each restricted stock unit represents the right to receive, at settlement, one share of common stock.</footnote>
    </footnotes>

    <ownerSignature>
        <signatureName>/s/ Michael L. Cheravitch by Julie E. Shaw Power of Attorney</signatureName>
        <signatureDate>2026-01-16</signatureDate>
    </ownerSignature>
</ownershipDocument>
