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

    <schemaVersion>X0206</schemaVersion>

    <documentType>3</documentType>

    <periodOfReport>2016-03-30</periodOfReport>

    <noSecuritiesOwned>0</noSecuritiesOwned>

    <issuer>
        <issuerCik>0001597313</issuerCik>
        <issuerName>ViewRay, Inc.</issuerName>
        <issuerTradingSymbol>VRAY</issuerTradingSymbol>
    </issuer>

    <reportingOwner>
        <reportingOwnerId>
            <rptOwnerCik>0001572451</rptOwnerCik>
            <rptOwnerName>Bonita David P</rptOwnerName>
        </reportingOwnerId>
        <reportingOwnerAddress>
            <rptOwnerStreet1>C/O VIEWRAY, INC.</rptOwnerStreet1>
            <rptOwnerStreet2>2 THERMO FISHER WAY</rptOwnerStreet2>
            <rptOwnerCity>OAKWOOD VILLAGE</rptOwnerCity>
            <rptOwnerState>OH</rptOwnerState>
            <rptOwnerZipCode>44146</rptOwnerZipCode>
            <rptOwnerStateDescription></rptOwnerStateDescription>
        </reportingOwnerAddress>
        <reportingOwnerRelationship>
            <isDirector>1</isDirector>
            <isOfficer>0</isOfficer>
            <isTenPercentOwner>1</isTenPercentOwner>
            <isOther>0</isOther>
            <officerTitle></officerTitle>
            <otherText></otherText>
        </reportingOwnerRelationship>
    </reportingOwner>

    <nonDerivativeTable>
        <nonDerivativeHolding>
            <securityTitle>
                <value>Common Stock</value>
            </securityTitle>
            <postTransactionAmounts>
                <sharesOwnedFollowingTransaction>
                    <value>7914545</value>
                </sharesOwnedFollowingTransaction>
            </postTransactionAmounts>
            <ownershipNature>
                <directOrIndirectOwnership>
                    <value>I</value>
                </directOrIndirectOwnership>
                <natureOfOwnership>
                    <value>See footnote</value>
                    <footnoteId id="F1"/>
                    <footnoteId id="F2"/>
                </natureOfOwnership>
            </ownershipNature>
        </nonDerivativeHolding>
        <nonDerivativeHolding>
            <securityTitle>
                <value>Common Stock</value>
            </securityTitle>
            <postTransactionAmounts>
                <sharesOwnedFollowingTransaction>
                    <value>75371</value>
                </sharesOwnedFollowingTransaction>
            </postTransactionAmounts>
            <ownershipNature>
                <directOrIndirectOwnership>
                    <value>I</value>
                </directOrIndirectOwnership>
                <natureOfOwnership>
                    <value>See footnote</value>
                    <footnoteId id="F2"/>
                    <footnoteId id="F3"/>
                </natureOfOwnership>
            </ownershipNature>
        </nonDerivativeHolding>
    </nonDerivativeTable>

    <derivativeTable>
        <derivativeHolding>
            <securityTitle>
                <value>Stock Option (right to buy)</value>
            </securityTitle>
            <conversionOrExercisePrice>
                <value>5</value>
            </conversionOrExercisePrice>
            <exerciseDate>
                <footnoteId id="F4"/>
            </exerciseDate>
            <expirationDate>
                <value>2025-07-23</value>
            </expirationDate>
            <underlyingSecurity>
                <underlyingSecurityTitle>
                    <value>Common Stock</value>
                </underlyingSecurityTitle>
                <underlyingSecurityShares>
                    <value>19556</value>
                </underlyingSecurityShares>
            </underlyingSecurity>
            <ownershipNature>
                <directOrIndirectOwnership>
                    <value>D</value>
                    <footnoteId id="F5"/>
                </directOrIndirectOwnership>
            </ownershipNature>
        </derivativeHolding>
    </derivativeTable>

    <footnotes>
        <footnote id="F1">These shares are held of record by OrbiMed Private Investments III, LP (&quot;OPI III&quot;). OrbiMed Capital GP III LLC (&quot;GP III&quot;) is the general partner of OPI III, and OrbiMed Advisors LLC (&quot;Advisors&quot;) is the managing member of GP III. Samuel D. Isaly (&quot;Isaly&quot;), a natural person, is the managing member of and owner of a controlling interest in Advisors. By virtue of such relationships, GP III, Advisors and Isaly may be deemed to have voting and investment power over the securities held by OPI III and as a result may be deemed to have beneficial ownership over such securities. The Reporting Person is an employee of Advisors.</footnote>
        <footnote id="F2">Each of GP III, Advisors, Isaly and the Reporting Person disclaims beneficial ownership of the securities reported herein for purposes of Rule 16a-1(a) under the Securities Exchange Act of 1934, as amended (the &quot;Exchange Act&quot;), except to the extent of its or his pecuniary interest therein, if any. This report on Form 3 shall not be deemed an admission that any such entity or person is a beneficial owner of such securities for the purpose of Section 16 of the Exchange Act, or for any other purpose.</footnote>
        <footnote id="F3">These shares are held of record by OrbiMed Associates III, LP (&quot;Associates III&quot;). Advisors is the general partner of Associates III. Isaly is the managing member of and owner of a controlling interest in Advisors. By virtue of such relationships, Advisors and Isaly may be deemed to have voting and investment power over the securities held by Associates III and as a result may be deemed to have beneficial ownership over such securities.</footnote>
        <footnote id="F4">The shares subject to the option vest in 12 monthly installments on each monthly anniversary of July 23, 2015 (the &quot;Vesting Commencement Date&quot;) until such shares subject to the option have become fully vested and exercisable.</footnote>
        <footnote id="F5">The Reporting Person is an employee of Advisors and is obligated to transfer any shares issued under equity grants made to him by the Issuer, or the economic benefits thereof, to Advisors for the ultimate benefit of OPI III and Associates III.</footnote>
    </footnotes>

    <ownerSignature>
        <signatureName>/s/ Wesley Mintu, Wesley Mintu, as Attorney-in-Fact for David P. Bonita</signatureName>
        <signatureDate>2016-03-30</signatureDate>
    </ownerSignature>
</ownershipDocument>
